mirror of https://github.com/mkerrisk/man-pages
216 lines
7.7 KiB
Groff
216 lines
7.7 KiB
Groff
|
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
|
||
|
.TH "NOHUP" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
||
|
.\" nohup
|
||
|
.SH NAME
|
||
|
nohup \- invoke a utility immune to hangups
|
||
|
.SH SYNOPSIS
|
||
|
.LP
|
||
|
\fBnohup\fP \fIutility\fP \fB[\fP\fIargument\fP\fB...\fP\fB]\fP
|
||
|
.SH DESCRIPTION
|
||
|
.LP
|
||
|
The \fInohup\fP utility shall invoke the utility named by the \fIutility\fP
|
||
|
operand with arguments supplied as the
|
||
|
\fIargument\fP operands. At the time the named \fIutility\fP is invoked,
|
||
|
the SIGHUP signal shall be set to be ignored.
|
||
|
.LP
|
||
|
If the standard output is a terminal, all output written by the named
|
||
|
\fIutility\fP to its standard output shall be appended to
|
||
|
the end of the file \fBnohup.out\fP in the current directory. If \fBnohup.out\fP
|
||
|
cannot be created or opened for appending, the
|
||
|
output shall be appended to the end of the file \fBnohup.out\fP in
|
||
|
the directory specified by the \fIHOME\fP environment
|
||
|
variable. If neither file can be created or opened for appending,
|
||
|
\fIutility\fP shall not be invoked. If a file is created, the
|
||
|
file's permission bits shall be set to S_IRUSR | S_IWUSR.
|
||
|
.LP
|
||
|
If the standard error is a terminal, all output written by the named
|
||
|
\fIutility\fP to its standard error shall be redirected to
|
||
|
the same file descriptor as the standard output.
|
||
|
.SH OPTIONS
|
||
|
.LP
|
||
|
None.
|
||
|
.SH OPERANDS
|
||
|
.LP
|
||
|
The following operands shall be supported:
|
||
|
.TP 7
|
||
|
\fIutility\fP
|
||
|
The name of a utility that is to be invoked. If the \fIutility\fP
|
||
|
operand names any of the special built-in utilities in \fISpecial
|
||
|
Built-In Utilities\fP , the results are undefined.
|
||
|
.TP 7
|
||
|
\fIargument\fP
|
||
|
Any string to be supplied as an argument when invoking the utility
|
||
|
named by the \fIutility\fP operand.
|
||
|
.sp
|
||
|
.SH STDIN
|
||
|
.LP
|
||
|
Not used.
|
||
|
.SH INPUT FILES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH ENVIRONMENT VARIABLES
|
||
|
.LP
|
||
|
The following environment variables shall affect the execution of
|
||
|
\fInohup\fP:
|
||
|
.TP 7
|
||
|
\fIHOME\fP
|
||
|
Determine the pathname of the user's home directory: if the output
|
||
|
file \fBnohup.out\fP cannot be created in the current
|
||
|
directory, the \fInohup\fP utility shall use the directory named by
|
||
|
\fIHOME\fP to create the file.
|
||
|
.TP 7
|
||
|
\fILANG\fP
|
||
|
Provide a default value for the internationalization variables that
|
||
|
are unset or null. (See the Base Definitions volume of
|
||
|
IEEE\ Std\ 1003.1-2001, Section 8.2, Internationalization Variables
|
||
|
for
|
||
|
the precedence of internationalization variables used to determine
|
||
|
the values of locale categories.)
|
||
|
.TP 7
|
||
|
\fILC_ALL\fP
|
||
|
If set to a non-empty string value, override the values of all the
|
||
|
other internationalization variables.
|
||
|
.TP 7
|
||
|
\fILC_CTYPE\fP
|
||
|
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).
|
||
|
.TP 7
|
||
|
\fILC_MESSAGES\fP
|
||
|
Determine the locale that should be used to affect the format and
|
||
|
contents of diagnostic messages written to standard
|
||
|
error.
|
||
|
.TP 7
|
||
|
\fINLSPATH\fP
|
||
|
Determine the location of message catalogs for the processing of \fILC_MESSAGES
|
||
|
\&.\fP
|
||
|
.TP 7
|
||
|
\fIPATH\fP
|
||
|
Determine the search path that is used to locate the utility to be
|
||
|
invoked. See the Base Definitions volume of
|
||
|
IEEE\ Std\ 1003.1-2001, Chapter 8, Environment Variables.
|
||
|
.sp
|
||
|
.SH ASYNCHRONOUS EVENTS
|
||
|
.LP
|
||
|
The \fInohup\fP utility shall take the standard action for all signals
|
||
|
except that SIGHUP shall be ignored.
|
||
|
.SH STDOUT
|
||
|
.LP
|
||
|
If the standard output is not a terminal, the standard output of \fInohup\fP
|
||
|
shall be the standard output generated by the
|
||
|
execution of the \fIutility\fP specified by the operands. Otherwise,
|
||
|
nothing shall be written to the standard output.
|
||
|
.SH STDERR
|
||
|
.LP
|
||
|
If the standard output is a terminal, a message shall be written to
|
||
|
the standard error, indicating the name of the file to which
|
||
|
the output is being appended. The name of the file shall be either
|
||
|
\fBnohup.out\fP or \fB$HOME/nohup.out\fP.
|
||
|
.SH OUTPUT FILES
|
||
|
.LP
|
||
|
If the standard output is a terminal, all output written by the named
|
||
|
\fIutility\fP to the standard output and standard error
|
||
|
is appended to the file \fBnohup.out\fP, which is created if it does
|
||
|
not already exist.
|
||
|
.SH EXTENDED DESCRIPTION
|
||
|
.LP
|
||
|
None.
|
||
|
.SH EXIT STATUS
|
||
|
.LP
|
||
|
The following exit values shall be returned:
|
||
|
.TP 7
|
||
|
126
|
||
|
The utility specified by \fIutility\fP was found but could not be
|
||
|
invoked.
|
||
|
.TP 7
|
||
|
127
|
||
|
An error occurred in the \fInohup\fP utility or the utility specified
|
||
|
by \fIutility\fP could not be found.
|
||
|
.sp
|
||
|
.LP
|
||
|
Otherwise, the exit status of \fInohup\fP shall be that of the utility
|
||
|
specified by the \fIutility\fP operand.
|
||
|
.SH CONSEQUENCES OF ERRORS
|
||
|
.LP
|
||
|
Default.
|
||
|
.LP
|
||
|
\fIThe following sections are informative.\fP
|
||
|
.SH APPLICATION USAGE
|
||
|
.LP
|
||
|
The \fIcommand\fP, \fIenv\fP, \fInice\fP, \fInohup\fP, \fItime\fP,
|
||
|
and \fIxargs\fP utilities have been specified to use exit code 127
|
||
|
if an error occurs so that
|
||
|
applications can distinguish "failure to find a utility" from "invoked
|
||
|
utility exited with an error indication". The value 127
|
||
|
was chosen because it is not commonly used for other meanings; most
|
||
|
utilities use small values for "normal error conditions" and
|
||
|
the values above 128 can be confused with termination due to receipt
|
||
|
of a signal. The value 126 was chosen in a similar manner to
|
||
|
indicate that the utility could be found, but not invoked. Some scripts
|
||
|
produce meaningful error messages differentiating the 126
|
||
|
and 127 cases. The distinction between exit codes 126 and 127 is based
|
||
|
on KornShell practice that uses 127 when all attempts to
|
||
|
\fIexec\fP the utility fail with [ENOENT], and uses 126 when any attempt
|
||
|
to \fIexec\fP the utility fails for any other
|
||
|
reason.
|
||
|
.SH EXAMPLES
|
||
|
.LP
|
||
|
It is frequently desirable to apply \fInohup\fP to pipelines or lists
|
||
|
of commands. This can be done by placing pipelines and
|
||
|
command lists in a single file; this file can then be invoked as a
|
||
|
utility, and the \fInohup\fP applies to everything in the
|
||
|
file.
|
||
|
.LP
|
||
|
Alternatively, the following command can be used to apply \fInohup\fP
|
||
|
to a complex command:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fBnohup sh -c '\fP\fIcomplex-command-line\fP\fB'
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.SH RATIONALE
|
||
|
.LP
|
||
|
The 4.3 BSD version ignores SIGTERM and SIGHUP, and if \fB./nohup.out\fP
|
||
|
cannot be used, it fails instead of trying to use
|
||
|
\fB$HOME/nohup.out\fP.
|
||
|
.LP
|
||
|
The \fIcsh\fP utility has a built-in version of \fInohup\fP that acts
|
||
|
differently from the \fInohup\fP defined in this volume
|
||
|
of IEEE\ Std\ 1003.1-2001.
|
||
|
.LP
|
||
|
The term \fIutility\fP is used, rather than \fIcommand\fP, to highlight
|
||
|
the fact that shell compound commands, pipelines,
|
||
|
special built-ins, and so on, cannot be used directly. However, \fIutility\fP
|
||
|
includes user application programs and shell
|
||
|
scripts, not just the standard utilities.
|
||
|
.LP
|
||
|
Historical versions of the \fInohup\fP utility use default file creation
|
||
|
semantics. Some more recent versions use the
|
||
|
permissions specified here as an added security precaution.
|
||
|
.LP
|
||
|
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
|
||
|
\fInohup\fP should only modify the handling of SIGHUP as
|
||
|
required by this volume of IEEE\ Std\ 1003.1-2001.
|
||
|
.SH FUTURE DIRECTIONS
|
||
|
.LP
|
||
|
None.
|
||
|
.SH SEE ALSO
|
||
|
.LP
|
||
|
\fIShell Command Language\fP , \fIsh\fP , the System Interfaces
|
||
|
volume of IEEE\ Std\ 1003.1-2001, \fIsignal\fP()
|
||
|
.SH COPYRIGHT
|
||
|
Portions of this text are reprinted and reproduced in electronic form
|
||
|
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
|
||
|
-- Portable Operating System Interface (POSIX), The Open Group Base
|
||
|
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
|
||
|
Electrical and Electronics Engineers, Inc and The Open Group. In the
|
||
|
event of any discrepancy between this version and the original IEEE and
|
||
|
The Open Group Standard, the original IEEE and The Open Group Standard
|
||
|
is the referee document. The original Standard can be obtained online at
|
||
|
http://www.opengroup.org/unix/online.html .
|