How-to-simply...

Continue running background task after session logout on Linux

  • 1 Start your task from the terminal
  • 2 Press CTRL+Z to suspend running task
    [1]+ Stopped long-running-task
  • 3 disown -h %1 # ignore SIGHUP signal
  • 4 bg 1 # resumes the job 1 in the background
  • 5 Alternative with a different user:
    $ sudo -u rsync nohup bash sync.sh
    $ disown
  • N Log-out and it will continue running

References