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 $_; }
In reply to inetd spawned perl problem by vasu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |