nohup
PURPOSE
Runs a command without hangups and quits.
SYNOPSIS
nohup command [ arguments ]
DESCRIPTION
The nohup command runs command, ignoring all hangups and
quit signals. You can use this command to run programs
in the background after you log off of the system. To
run a nohup command in the background, add an "&" to the
end of the command.
If nohup output is redirected to a terminal or is not
redirected at all, the output goes to the file nohup.out.
If nohup.out is not writable in the current directory,
the output is redirected to $HOME/nohup.out.
The syntax of this command ignores quits and hangups for
only one command. If you want to apply nohup to a pipe-
line or list of commands, you can put the pipeline or
list in a shell script file. Then you can run sh as the
command using the format: "nohup sh" file. You can also
assign the shell file execute permission and run it as
the command in the form: "nohup" file.
EXAMPLES
1. To leave a command running after you log out:
nohup find / -print &
Shortly after you enter this, the following is dis-
played:
670
$ Sending output to nohup.out
The number will probably be different when you use
this command. It is the ID of the background process
started by "&" (ampersand). (See page about starting
background processes with "&".) The "$" (dollar
sign) is your shell prompt. "Sending output . . . "
is a message from nohup telling you that it is
storing the output from the ".find" command in the
file "nohup.out". You can log out after you see
these messages, even if the "find" command has not
finished yet.
2. To do the same, but redirecting the standard output
to a different file:
nohup find / -print >filenames &
This runs the "find" command and stores its output in
a file named "filenames". Now only the process ID
and your prompt are displayed:
677
$
Wait for a second or two before logging off, because
the nohup command takes a moment to start the command
you specified. If you log off too quickly, your
command may not run at all. Once your command has
started, logging off will not affect it.
3. To run more than one command, use a shell procedure.
For example, if you write the shell procedure:
neqn math1 ] nroff > fmath1
and name it "nnfmath1", you can run nohup for all of
the commands in "nnfmath1" with the command:
nohup sh nnmath1
If you assign "nnfmath1" execute permission, you can
obtain the same results by issuing the command:
nohup nnmath1
To run this command in the background, enter the
command:
nohup nnmath1 &
RELATED INFORMATION
The following commands: "csh," "nice," and "sh."
Note: The csh command contains a built-in subcommand
named nohup. The command and subcommand do not neces-
sarily work the same way. For information on the subcom-
mand, see the csh command.
The signal system call in AIX Operating System Technical
Reference.