[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

using inetd to run arbitrary programs



I'm running a couple of tcp-pipes (ssh -L ...) to get around the 
fact that my ISP is not on the same network as my news/imap/ provider
and so on. I've been starting these pipes at boot time (by calling
the appropriate script in /etc/network/interfaces) and that works fine.
But I thought I'd get clever and start them through inetd instead,
so I don't have a bunch of ssh processes sitting around when I don't need
them. I put the appropriate entries in /etc/services and /etc/inetd.conf
and that seems to work: when I telnet to the given local port the 
tcp-pipe script is run. Only problem is, when the script finishes
the telnet session says "Connection closed" and that's it.
Presumably this is because inetd is designed for calling programs 
that handle the request, whereas I'm trying to use it to call
an arbitrary script. How can I set things up so that inetd starts 
the tcp-pipe, puts the connection on hold until the tcp-pipe is set up
(or for X number of seconds) and then lets the connection resume as
if inetd had never existed?  Also nice would be a feature whereby the
tcp-pipe is shut down once there are no connections using it, 
or X number of seconds after the last such connection exited.
-chris



Reply to: