nohup(1)
NAME
nohup − run a command immune to hangups and quits
SYNOPSIS
/usr/bin/nohup command [ arguments ]
AVAILABILITY
SUNWcsu
DESCRIPTION
There are three distinct versions of nohup: it is built in to the C shell and is an executable program available in /usr/bin/nohup when using the Bourne shell.
The Bourne shell version of nohup executes command such that it is immune to HUP (hangup) and TERM (terminate) signals. If the standard output is a terminal, it is redirected to the file nohup.out. The standard error is redirected to follow the standard output.
The priority is incremented by 5. nohup should be invoked from the shell with ‘&’ in order to prevent it from responding to interrupts or input from the next user.
SYSTEM V DESCRIPTON
Processes run by nohup are immune to HUP (hangup) and QUIT (quit) signals; nohup does not arrange to make them immune to a TERM (terminate) signal, so unless they arrange to be immune to a TERM signal, or the shell makes them immune to a TERM signal, they will receive that signal. If nohup.out is not writable in the current directory, output is redirected to $HOME/nohup.out. If the standard error is a terminal, it is redirected to the standard output, otherwise it is not redirected. The priority of the process run by nohup is not altered.
EXAMPLES
It is frequently desirable to apply nohup to pipelines or lists of commands. This can be done only by placing pipelines and command lists in a single file, called a shell procedure. One can then issue:
example% nohup sh filename
and the nohup applies to everything in filename. If the shell procedure filename is to be executed often, then the need to type sh can be eliminated by giving filename execute permission. Add an ampersand and the contents of filename are run in the background with interrupts also ignored (see sh(1)):
example% nohup filename &
An example of what the contents of filename could be is:
example% sort ofilename > nfilename
ENVIRONMENT
If any of the LC_∗ variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY ) (see environ(5)) are not set in the environment, the operational behavior of nohup for each corresponding locale category is determined by the value of the LANG environment variable. If LC_ALL is set, its contents are used to override both the LANG and the other LC_∗ variables. If none of the above variables is set in the environment, the "C" (U.S. style) locale determines how nohup behaves.
LC_CTYPE
Determines how nohup handles characters. When LC_CTYPE is set to a valid value, nohup can display and handle text and filenames containing valid characters for that locale. nohup can display and handle Extended Unix Code (EUC) characters where any individual character can be 1, 2, or 3 bytes wide. nohup can also handle EUC characters of 1, 2, or more column widths. In the "C" locale, only characters from ISO 8859-1 are valid.
LC_MESSAGES
Determines how diagnostic and informative messages are presented. This includes the language and style of the messages, and the correct form of affirmative and negative responses. In the "C" locale, the messages are presented in the default form found in the program itself (in most cases, U.S. English).
SEE ALSO
chmod(1), csh(1), nice(1), sh(1), signal(2), environ(5)
NOTES
If you use csh(1), then commands executed with ‘&’ are automatically immune to HUP signals while in the background.
There is a C shell built-in command nohup that provides immunity from terminate, but does not redirect output to nohup.out.
nohup does not recognize command sequences. In the case of the following command
example% nohup command1; command2
nohup applies only to command1. The command
example% nohup (command1; command2)
is syntactically incorrect.
SunOS 5.1 — Last change: 14 Sep 1992