Background processes on logout

Tom Christiansen tchrist at convex.COM
Fri Feb 22 05:42:22 AEST 1991


>From the keyboard of dfraser at libws1.ic.sunysb.edu (David W Fraser):
:In article <91051.180110F66204 at BARILVM.BITNET> F66204 at BARILVM.BITNET (Shaul Wallach) writes:
:>
:>   Please excuse this beginner's question. Is there any way for a
:>user to log out of a UNIX system (say AIX/6000) while leaving
:>background processes active? My experience seems to be that the
:>logout command kills all background processes, something I want
:>to prevent.
:>
:>Thanks,
:>
:>Shaul Wallach
:
:Well I have the opposite problem.  I am using HP-UX 7.0, and when I logout my
:background processes continue running.  Is there any way I can prevent this?
:Such as adding something to my .logout file?

It's a matter of shells and process groups and job control.  The csh puts background
jobs in different process groups.  When you log out, stopped jobs die but those
running continue doing so.  Those of us accustomed to this behavior think anything
else is a pain.  If you want them to die, you should hunt them down and kill them,
or make them do something like check to see when getppid() goes to 1 (orphaned
procs get inherited by init.)

On the other end of the spectrum is sh, who doesn't switch process groups on 
backgrounded commands, and who kills all its children when you logout.  To 
avoid this, there's a nohup prefix command that you can use to get around this.
I would really hate this behavior.  I don't want by running background jobs to
die just because the phone line glitches.

There may be some sloppiness in the above explanations, but I believe them 
to be essentially correct.

--tom
-- 
"UNIX was not designed to stop you from doing stupid things, because
 that would also stop you from doing clever things." -- Doug Gwyn

 Tom Christiansen                tchrist at convex.com      convex!tchrist



More information about the Comp.unix.questions mailing list