Wednesday 31 August 2016

Process running in background

Keeping a process running after ending ssh session could be very useful.

-------
The best way is often the simplest.
nohup long-running-command &
It was made specifically for this, it even logs stdout to nohup.log
man nohup
If you want to "background" some already running tasks, then your best bet is to ctrl+z then run
bg (this will background your most recent suspended task, allowing it to continue running)
then a quick disown should keep the process running after you log out.
screen and others can do it, but that's not what they're for. I recommend nohup for tasks you know your going to leave behind and bg for tasks your already running and don't want to re-start.
Keep in mind, both are bash specific. If you're not using bash, then the commands could be different.
----
Extracted from http://askubuntu.com/questions/8653/how-to-keep-processes-running-after-ending-ssh-session

No comments:

Post a Comment