An administrator wants to ensure that a background process continues running after logout. Which command should be used to start the process?
Trap 1: runproc sleep 100 &
runproc is not a standard Linux command, so this fails immediately. The scenario requires detaching the process from the controlling terminal, which nohup or setsid achieves; runproc resembles nohup superficially but provides no such mechanism on any standard distribution.
Trap 2: sleep 100 &
Runs in background but will be terminated on logout.
Trap 3: sleep 100 & disown
Does remove job from shell's job control, but SIGHUP may still be sent if not handled; nohup is preferred.
- A
nohup sleep 100 &
nohup detaches the process from the controlling terminal and ignores SIGHUP, so the sleep command survives logout, while the trailing '&' backgrounds it. This satisfies the requirement that the process continue running after the session ends.
- B
runproc sleep 100 &
Why it fails: runproc is not a standard Linux command, so this fails immediately. The scenario requires detaching the process from the controlling terminal, which nohup or setsid achieves; runproc resembles nohup superficially but provides no such mechanism on any standard distribution.
- C
sleep 100 &
Why it fails: Runs in background but will be terminated on logout.
- D
sleep 100 & disown
Why it fails: Does remove job from shell's job control, but SIGHUP may still be sent if not handled; nohup is preferred.