Detach proc from shell

Problem

When you exit your shell, the processes you’ve kicked off die.



Solution

If you start a process with nohop (ignore the hup signal), it will not exit (usually) when your shell is exited. nohup stands for no hang up, a throw back to terminal lines.



Example


nohup command > /tmp/logfile.log 2>&1&

If you forget to run the command with nohup, this can now be simulated on solaris.

Just background the process (with ctrl Z and bg) then type disown.

disown [%1]

The UNIX command jobs will show all backgrounded jobs. After running disown, it should show no jobs in the background.



Reference

[tags]nohup, disown, daemons, Unix Coding School[/tags]



Leave a Reply

Your email address will not be published. Required fields are marked *