Linux – Using nohup when initial input is required

linuxnohup

On a linux system is there any way to use nohup when the process that is being nohuped required input, such as an rsync command that needs a password to be entered but will then run happily on its own?

Best Answer

If the command doesn't have to be scripted, you can do it this way:

  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)