Services and User Management

An administrator is connected to a server over SSH and must run ./backup.sh so that it survives a dropped connection. Its output must go to /tmp/backup.log, and the shell prompt must be available right away. Which command meets these requirements?

Show the answer

Correct answerA. nohup ./backup.sh > /tmp/backup.log 2>&1 &

nohup makes the script ignore SIGHUP when the SSH session ends, and the trailing & returns the prompt immediately. Without nohup, the backgrounded job can still receive SIGHUP from the closing shell. Without &, the job survives but holds the terminal.