starting a service on use

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Fri Oct 8 13:56:57 UTC 2010


On Thu, Oct 07, 2010 at 06:52:12PM -0400, Rajinder Yadav wrote:
> how do i start a service when a request comes in?
> i don't want the service running when the system boots up.

inetd will launch things when a connection happens to a given port.

However, in that case inetd is the one listening on the port, and I
believe it requires launching one copy of the service per connection,
and when the connection finishes the service instance terminates again.

So unless the service can have multiple instances at once (which pretty
much means it was designed to work with inet as an option) then there
really is no good way to do what you want.  The only way to recognize
the incoming connection is to be listening on the port, but if you do
that then you have to be the one that handles the request (or pass it
on in the case of inetd).  You could perhaps make a program that ran
on the port and when it got a connection request it disconnected from
the port and launched the real service, but then your first connection
attempt would always fail and you would have to try again after the real
service launched.  That's pretty yucky really.

So really, if you want a service, run it all the time, unless it supports
inetd, in which case it can handle it.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list