stevesu@azure.UUCP (Steve Summit) (11/22/83)
It appears that it is impossible to nohup a process which was invoked by a remote shell using the 4.1(a, maybe) rlogin command. The rlogind program (which is the daemon that runs on the remote host and is the parent of the remote shell) invokes a routine called cleanup() when the remote shell terminates. Among other things, cleanup() does a kill(0, SIGKILL). Since SIGKILL "cannot be caught or ignored," all of your remote processes get terminated at that time, even if you nohup'ed them and put them in the background. If the last thing you did before you logged out was an lpr, the lpr daemon, which had put itself in the background and ignored SIGHUP, would die, too. Furthermore, it wouldn't have a chance to remove its lock file, so the lpr would be hung until the lock file was manually removed and the daemon restarted. Under 4.2, cleanup() does a vhangup() and a shutdown() before the kill(). vhangup() and shutdown() apparently hang up and shut down the login and socket connection (I haven't finished reading the 4.2 documentation yet). vhanghup() sends everybody a SIGHUP, which is sensible, but unless vhangup() or shutdown() also diddles with the process group, the kill() will still kill everything. My question is this: does anyone know why cleanup() does a kill(0, SIGKILL) instead of a kill(0, SIGHUP)? We haven't converted to 4.2 yet, so I don't know if the change is needed there, but am I likely to break something in the 4.1 rlogind if I change the SIGKILL to a SIGHUP? Steve Summit Tektronix, Inc. tektronix!tekmdp!stevesu P.S. Please DON'T remind me that if I was using csh my background processes would be in a separate process group and hence immune to any kill (0, ...). Some of us still like, and use, the Bourne shell.