nohup
Published on 24 Mar 2004Tags #Bash #Linux
The nohup command allows executing programs which are safe from hangup signals:
nohup COMMAND [&]
The command is not pushed in the background (see Job Control for details). Also, it does not change the niceness of the command (see Nice for details).
nohup also ensures that any output is captured and redirected to a file. The two files ./nohup.out and ${HOME}/nohup.out are tried in the presented order and, if possible, is created with 0600 permissions. If the selected file already exists, it will not be overwritten nor will its permissions be modified but instead the output is appended.
It also ensures that any output is redirected either to ./nohup.out or ${HOME}/nohup.out. If not present one of these files will be created with 600 permissions although if the file is present the permissions are not modified.
The exit code of nohup:
-
126
COMMANDcould not be invoked although it was found -
127
nohupfailed (e.g.COMMANDcould not be found)
If COMMAND was successfully invoked, the exit code will be that of COMMAND.