Services and User Management
A user runs nohup ./export.sh & from a terminal without redirecting its output, then logs out. What happens to the script?
Show the answer
Correct answerA. It keeps running, and its output is appended to a file named nohup.out
AWhy this is right: nohup ignores SIGHUP and, when stdout is a terminal, appends output to nohup.out.
BWhy not this: nohup keeps the output in nohup.out; it is discarded only if the user redirects it to /dev/null.
CWhy not this: nohup sets the command to ignore SIGHUP, so logging out does not end it.
DWhy not this: Mailing output to the user is what at and cron do; nohup writes it to nohup.out.
nohup makes the command ignore SIGHUP and, when stdout is a terminal, sends output to nohup.out. It does not background the command by itself, which is why the trailing & is used to get the prompt back.