Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!convex!tchrist From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.questions Subject: Re: Background processes on logout Message-ID: <1991Feb21.184222.9142@convex.com> Date: 21 Feb 91 18:42:22 GMT References: <91051.180110F66204@BARILVM.BITNET> <1991Feb21.164300.3596@sbcs.sunysb.edu> Sender: tchrist@convex.com (Tom Christiansen) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 39 From the keyboard of dfraser@libws1.ic.sunysb.edu (David W Fraser): :In article <91051.180110F66204@BARILVM.BITNET> F66204@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@convex.com convex!tchrist