In <[EMAIL PROTECTED]>, Ariel Biener 
<[EMAIL PROTECTED]> writes:

> > > Does anybody know a shell command that allows me to run something in the
> > > background immediately?
> > 
> > Use nohup if you're using a Bourne shell (sh) descendant.
> > 
> > Just use `&' if you're using a C shell (csh) descendant.
> 
> Both will terminate as soon as they are detached from the controlling
> terminal. Backgrounding jobs using `&' require that the job be configured
> (compiled in that way) to ignore some signals from the controlling
> terminal, in order for them not to terminate when the controlling terminal
> is killed.

Oh, really?

A ``job'' is a process group.  When a session leader (e.g. a shell)
exits, the kernel checks whether there is a controlling terminal
associated with its session.  If so, the foreground process group of
that terminal is signaled with exactly one ``signals'', SIGHUP.

Shells without job control don't deal with process groups at all, and
so all their children get SIGHUP'd when they exit.  For these cases,
nohup(1) simply invokes commands with SIGHUP ignored.  (Obviously, if
you run a program that independently installs a SIGHUP handler with
`&' under sh, that handler will get called when the shell exits, which 
may or may not be alright.)

Shells with job control (csh descendants, bash, some incarnations of
sh, etc) have, well, JOB CONTROL.  Jobs are started in their own
process groups, and the shell changes the terminal's foreground
process group whenever a job is brought into the foreground (e.g. with 
`fg').  Therefore, the kernel won't send a SIGHUP to background jobs.


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to