Runs a command without hangups.
nohup { -p pid | Command [ Arg ... ] [ & ] }
The nohup command runs the command specified by the Command parameter and any related Arg parameters, ignoring all hangup (SIGHUP) signals or modifies the process specified with -p option to ignore all hangup (SIGHUP) signals.
Item | Description |
---|---|
-p pid | pid is the process-id of a running process. The nohup command modifies the specified process, to ignore all hangup (SIGHUP) signals. |
This command returns the following exit values:
Item | Description |
---|---|
126 | The command specified by the Command parameter was found but could not be invoked. |
127 | An error occurred in the nohup command or the command specified by the Command parameter could not be found. |
Otherwise, the exit status of the nohup command is that of the command specified by the Command parameter.
$ nohup find / -print &
After you enter
this command, the following is displayed: 670
$ Sending output to nohup.out
The process ID number changes
to that of the background process started by & (ampersand). The
message Sending output to nohup.out informs you that the
output from the find / -print command is in the nohup.out file.
You can log off after you see these messages, even if the find command
is still running. $ nohup find / -print >filenames &
This
example runs the find / -print command and stores its output
in a file named filenames. Now only the process ID and prompt
are displayed: 677
$
Wait before logging off because the nohup command
takes a moment to start the command specified by the Command parameter.
If you log off too quickly, the command specified by the Command parameter
may not run at all. Once the command specified by the Command parameter
starts, logging off does not affect it.neqn math1 | nroff > fmath1
and
name it the nnfmath1 file, you can run the nohup command
for all of the commands in the nnfmath1 file with the command:
nohup sh nnfmath1
nohup nnfmath1
nohup nnfmath1
&
nohup ksh nnfmath1
nohup -p 161792