Using nohup when initial input is required?

While you can use nohup for getting the command running even after logged out via SSH, there are times when you need to interact with the command first before it can go on with the job, such as with rsync. In this case, you need this instead of nohup:

  1. run it in the foreground
  2. pause it (CTRL+Z)
  3. disown it so that it won’t be closed when you close your shell (disown -h %jobid)
  4. resume the job in the background (bg %jobid)

jobid is usually 1 or you don’t have to provide it.

You a slightly different procedure if the above doesn’t work:

  1. run it in foreground
  2. CTRL+Z
  3. bg
  4. disown

That’s it.

Leave a Comment

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

Scroll to Top