[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: NOHUP



Oommen Thomas wrote:

> glynn> > AFAIK, unless we spec a 'nohup' any user process running in the
> glynn> > background, will terminate once s/he logs out.
> glynn> 
> glynn> Not necessarily. The process will receive SIGHUP. The default
> glynn> disposition for SIGHUP is to terminate the process, but a program can
> glynn> override this if it wishes.
> 
> But stty -a shows hupcl as default.

That has nothing to do with SIGHUP; it's actually the opposite.

`stty hupcl' causes the modem to be hung up when the last process
closes the tty.

SIGHUP is sent to the foreground process group when the serial driver
detects a hangup.

> Why then does background processes not get killed at all, when user logs
> out ? This happens with even simple shell scripts - say I have one with
> 'tail -f /etc/passwd' which if run in background, remains (sleeping)
> unatttached even after logging out. 

SIGHUP is only sent to the foreground process group.

-- 
Glynn Clements <glynn@xxxxxxxxxxxx>


------------------------------