June 2017
Beginner
502 pages
11h 26m
English
nohup is a Portable Operating System Interface (POSIX) command that prevents the process given as an argument from receiving the Hangup (HUP) signal. If we run a script preceding it with nohup, it will be shielded by the HUP signal sent to all the processes when the interactive session closes. If the standard output is a terminal, nohup appends it to the nohup.out file in the local directory and if it is not possible in the user's home directory while the standard error is redirected to the stdout. So something as follows:
zarrelli:~$ nohup ./while.sh &[1] 14247nohup: ignoring input and appending output to 'nohup.out'
The script is running in the background as jobs correctly reports:
zarrelli:~$ jobs[1]+ Running nohup ./while.sh &
Read now
Unlock full access