Skip to content

Instantly share code, notes, and snippets.

@cotyembry
Created August 21, 2017 00:26
Show Gist options
  • Save cotyembry/0b66ae9e02d683da490ac036b804964c to your computer and use it in GitHub Desktop.
Save cotyembry/0b66ae9e02d683da490ac036b804964c to your computer and use it in GitHub Desktop.

Revisions

  1. cotyembry created this gist Aug 21, 2017.
    18 changes: 18 additions & 0 deletions raspberrypiLinuxBackgroundProcess.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    from: https://askubuntu.com/questions/8653/how-to-keep-processes-running-after-ending-ssh-session
    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.