vasu has asked for the wisdom of the Perl Monks concerning the following question:
So, the intent is that a user or application makes a connection to the inetd port (for example, telnet localhost 9876), inetd spawns the perl script, which in turn runs remsh. The perl script has cleanup sub-routine setup for TERM, HUP, QUIT, PIPE signals. The setup works ok except that when the calling telnet/tcp process exits, the perl script is not getting any signal or any indication that the calling process has exited. The only time we get an indication that the calling process has exited is when the remsh returns some data to be written to STDOUT, at which time a SIGPIPE is signalled. I checked inetd code to see if it monitors the active socket; inetd just passes the control of the active socket essentially to the perl script (using dup2 and execv). An immediate indication I get that the calling process has exited is that the child remsh process either exits (HP-UX) or becomes defunct (Tru64) - This happens when I dont use the -n option for remsh. To cut a long story short, do you have any pointers on how I can detect that the calling process has exited ? Any different ways in which I can call remsh ? Also, is it possible for the perl process to check if the stdout has been closed without writing any data to the stdout ?open(RCMD, "remsh $h -l $u $script |") || die $!; while (<RCMD>) { print $_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: inetd spawned perl problem
by chip (Curate) on May 09, 2003 at 15:43 UTC | |
|
Re: inetd spawned perl problem
by Thelonius (Priest) on May 09, 2003 at 16:11 UTC | |
by vasu (Novice) on May 09, 2003 at 16:47 UTC | |
by Thelonius (Priest) on May 09, 2003 at 18:10 UTC | |
by vasu (Novice) on May 12, 2003 at 18:48 UTC |