[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: NOHUP
- Subject: Re: NOHUP
- From: Oommen Thomas <oommen@xxxxxxxxxxxxx>
- Date: Wed, 7 Apr 1999 14:32:42 +0530 (IST)
On Wed, 7 Apr 1999, Glynn Clements wrote:
glynn>
glynn> Oommen Thomas wrote:
glynn>
glynn> > glynn> > AFAIK, unless we spec a 'nohup' any user process running in the
glynn> > glynn> > background, will terminate once s/he logs out.
glynn> > glynn>
glynn> > glynn> Not necessarily. The process will receive SIGHUP. The default
glynn> > glynn> disposition for SIGHUP is to terminate the process, but a program can
glynn> > glynn> override this if it wishes.
glynn> >
glynn> > But stty -a shows hupcl as default.
glynn>
glynn> That has nothing to do with SIGHUP; it's actually the opposite.
glynn>
glynn> `stty hupcl' causes the modem to be hung up when the last process
glynn> closes the tty.
glynn>
glynn> SIGHUP is sent to the foreground process group when the serial driver
glynn> detects a hangup.
glynn>
glynn> > Why then does background processes not get killed at all, when user logs
glynn> > out ? This happens with even simple shell scripts - say I have one with
glynn> > 'tail -f /etc/passwd' which if run in background, remains (sleeping)
glynn> > unatttached even after logging out.
glynn>
glynn> SIGHUP is only sent to the foreground process group.
glynn>
glynn> --
OK
So, how to solve this problem?
ie. To get all background processes to terminate by default, when the user
logs out. Only when a 'nohup' is specified, must the process continue
unattached.
-
Oommen.
------------------------------