|NOHUP(1P)||POSIX Programmer's Manual||NOHUP(1P)|
nohup utility [argument...]
If standard input is associated with a terminal, the nohup utility may redirect standard input from an unspecified file.
If the standard output is a terminal, all output written by the named utility to its standard output shall be appended to the end of the file nohup.out in the current directory. If nohup.out cannot be created or opened for appending, the output shall be appended to the end of the file nohup.out in the directory specified by the HOME environment variable. If neither file can be created or opened for appending, utility shall not be invoked. If a file is created, the file's permission bits shall be set to S_IRUSR | S_IWUSR.
If standard error is a terminal and standard output is open but is not a terminal, all output written by the named utility to its standard error shall be redirected to the same open file description as the standard output. If standard error is a terminal and standard output either is a terminal or is closed, the same output shall instead be appended to the end of the nohup.out file as described above.
- The name of a utility that is to be invoked. If the utility operand names any of the special built-in utilities in Section 2.14, Special Built-In Utilities, the results are undefined.
- Any string to be supplied as an argument when invoking the utility named by the utility operand.
- Determine the pathname of the user's home directory: if the output file nohup.out cannot be created in the current directory, the nohup utility shall use the directory named by HOME to create the file.
- Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1‐2008, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)
- If set to a non-empty string value, override the values of all the other internationalization variables.
- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
- Determine the location of message catalogs for the processing of LC_MESSAGES.
- Determine the search path that is used to locate the utility to be invoked. See the Base Definitions volume of POSIX.1‐2008, Chapter 8, Environment Variables.
- The utility specified by utility was found but could not be invoked.
- An error occurred in the nohup utility or the utility specified by utility could not be found.
Otherwise, the exit status of nohup shall be that of the utility specified by the utility operand.
The following sections are informative.
Alternatively, the following command can be used to apply nohup to a complex command:
nohup sh −c 'complex-command-line' </dev/null
The csh utility has a built-in version of nohup that acts differently from the nohup defined in this volume of POSIX.1‐2008.
The term utility is used, rather than command, to highlight the fact that shell compound commands, pipelines, special built-ins, and so on, cannot be used directly. However, utility includes user application programs and shell scripts, not just the standard utilities.
Historical versions of the nohup utility use default file creation semantics. Some more recent versions use the permissions specified here as an added security precaution.
Some historical implementations ignore SIGQUIT in addition to SIGHUP; others ignore SIGTERM. An early proposal allowed, but did not require, SIGQUIT to be ignored. Several reviewers objected that nohup should only modify the handling of SIGHUP as required by this volume of POSIX.1‐2008.
Historical versions of nohup did not affect standard input, but that causes problems in the common scenario where the user logs into a system, types the command:
nohup make &
at the prompt, and then logs out. If standard input is not affected by nohup, the login session may not terminate for quite some time, since standard input remains open until make exits. To avoid this problem, POSIX.1‐2008 allows implementations to redirect standard input if it is a terminal. Since the behavior is implementation-defined, portable applications that may run into the problem should redirect standard input themselves. For example, instead of:
nohup make &
an application can invoke:
nohup make </dev/null &
The Base Definitions volume of POSIX.1‐2008, Chapter 8, Environment Variables
The System Interfaces volume of POSIX.1‐2008, signal()
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
|2013||IEEE/The Open Group|