[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#445576: ITP: detach -- command to detach a process

>>>>> "Kevin" == Kevin Mark <kevin.mark@verizon.net> writes:

    Kevin> How is this different from 'nohup' or screen? 

Answer is on the website, quoted:

=== cut ===

When Slashdot found out about detach, ScriptedReplay asked why one
would use detach, instead of nohup, which comes with the system. The
truth is that I didn't find nohup when searching for a command that
would run another command detached from the terminal. The reason is
that nohup doesn't really do that:

nohup, as the name implies, makes your command ignore SIGHUP. That is,
unless you set a handler for it yourself, in which case you will still
receive the signal when the terminal exits. You can use normal shell
redirection and backgrounding on your process (although nohup will
automatically redirect standard output to nohup.out if you don't
redirect it).

detach uses the setsid system call to detach the command from the
terminal. This means your process simply won't get a SIGHUP when the
terminal exits, so you are free to use SIGHUP for things like
reloading configuration files (like many daemons do). The disadvantage
is that the standard file descriptors must be closed before calling
setsid. For this reason, normal redirection doesn't work with detach,
so explicit support for redirection has been added. detach also
contains an option for writing the pid of the detached process to a

=== cut ===
Brian May <bam@snoopy.debian.net>

Reply to: