[buug] nohup

Michael Paoli michael1cat at yahoo.com
Thu Aug 28 15:37:44 PDT 2003

nohup considered harmful(?) ;-)

I generally avoid using nohup for several reasons, including:
* pesky nohup.out files - most (all?) nohup implementations create the
nohup.out files even if there's no output (or standard error output) at
all, and are non-unique in their per home directory implementations,
also potentially leading to unintended overwrites and such
* ignoring SIGHUP - while at first glance this seems like a generally
good thing, allowing the process to continue, typically when invoking
login session exits and sends SIGHUP to its children, it tends to
introduce other problems, as often it is desirable to actually be able
to get SIGHUP to the process and not have it ignored (unless the process
would normally inherently ignore SIGHUP).
* It generally doesn't detach from the terminal - this can be a *bad
thing* when associations, such as invoking login session, are no longer
associated with the terminal
* potential process group issues

My general preference with such things is to fire them off under batch
(or at), advantages being:
* no pesky nohup.out file
* SIGHUP can still be usefully sent to the process
* process is cleanly invoked without a controlling terminal
* eliminate all or most process group issues

The only particular caveats I note with batch/at, is some
vendors/distributions have default configurations which may be
problematic (doesn't allow enough process to run under batch/at, or
defers starting of batch/at processes at too low a load threshold, or
runs batch/at processes at a niceness other than desired, or default
allow/deny is different from that desired).  These batch/at issues,
however, tend to mostly or entirely be configuration "set it and forget
it" type matters, which can generally be dealt with once, and then
typically aren't of subsequent concern.

--- johnd <john at jjdev.com> wrote:
> I've noticed if I run a program in the background then log out it stays
> running
> for a while then seems to arbitrarily stop.
> If I run it with nohup then it seems to stay running.

Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

More information about the buug mailing list