Detach proc from shell

[problem]

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

[/problem]

[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.

[/solution]

[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.

[/example]

[reference]

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

[/reference]

If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

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