Blame man-pages-posix-2013-a/man1p/nohup.1p

Packit 7cfc04
'\" et
Packit 7cfc04
.TH NOHUP "1P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
Packit 7cfc04
.SH PROLOG
Packit 7cfc04
This manual page is part of the POSIX Programmer's Manual.
Packit 7cfc04
The Linux implementation of this interface may differ (consult
Packit 7cfc04
the corresponding Linux manual page for details of Linux behavior),
Packit 7cfc04
or the interface may not be implemented on Linux.
Packit 7cfc04
Packit 7cfc04
.SH NAME
Packit 7cfc04
nohup
Packit 7cfc04
\(em invoke a utility immune to hangups
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.LP
Packit 7cfc04
.nf
Packit 7cfc04
nohup \fIutility \fB[\fIargument\fR...\fB]\fR
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The
Packit 7cfc04
.IR nohup
Packit 7cfc04
utility shall invoke the utility named by the
Packit 7cfc04
.IR utility
Packit 7cfc04
operand with arguments supplied as the
Packit 7cfc04
.IR argument
Packit 7cfc04
operands. At the time the named
Packit 7cfc04
.IR utility
Packit 7cfc04
is invoked, the SIGHUP signal shall be set to be ignored.
Packit 7cfc04
.P
Packit 7cfc04
If standard input is associated with a terminal, the
Packit 7cfc04
.IR nohup
Packit 7cfc04
utility may redirect standard input from an unspecified file.
Packit 7cfc04
.P
Packit 7cfc04
If the standard output is a terminal, all output written by the named
Packit 7cfc04
.IR utility
Packit 7cfc04
to its standard output shall be appended to the end of the file
Packit 7cfc04
.BR nohup.out
Packit 7cfc04
in the current directory. If
Packit 7cfc04
.BR nohup.out
Packit 7cfc04
cannot be created or opened for appending, the output shall be appended
Packit 7cfc04
to the end of the file
Packit 7cfc04
.BR nohup.out
Packit 7cfc04
in the directory specified by the
Packit 7cfc04
.IR HOME
Packit 7cfc04
environment variable. If neither file can be created or opened for
Packit 7cfc04
appending,
Packit 7cfc04
.IR utility
Packit 7cfc04
shall not be invoked. If a file is created, the file's permission bits
Packit 7cfc04
shall be set to S_IRUSR | S_IWUSR.
Packit 7cfc04
.P
Packit 7cfc04
If standard error is a terminal and standard output is open but is not
Packit 7cfc04
a terminal, all output written by the named utility to its standard
Packit 7cfc04
error shall be redirected to the same open file description as the
Packit 7cfc04
standard output. If standard error is a terminal and standard output
Packit 7cfc04
either is a terminal or is closed, the same output shall instead be
Packit 7cfc04
appended to the end of the
Packit 7cfc04
.BR nohup.out
Packit 7cfc04
file as described above.
Packit 7cfc04
.SH OPTIONS
Packit 7cfc04
None.
Packit 7cfc04
.SH OPERANDS
Packit 7cfc04
The following operands shall be supported:
Packit 7cfc04
.IP "\fIutility\fR" 10
Packit 7cfc04
The name of a utility that is to be invoked. If the
Packit 7cfc04
.IR utility
Packit 7cfc04
operand names any of the special built-in utilities in
Packit 7cfc04
.IR "Section 2.14" ", " "Special Built-In Utilities",
Packit 7cfc04
the results are undefined.
Packit 7cfc04
.IP "\fIargument\fR" 10
Packit 7cfc04
Any string to be supplied as an argument when invoking the utility
Packit 7cfc04
named by the
Packit 7cfc04
.IR utility
Packit 7cfc04
operand.
Packit 7cfc04
.SH STDIN
Packit 7cfc04
Not used.
Packit 7cfc04
.SH "INPUT FILES"
Packit 7cfc04
None.
Packit 7cfc04
.SH "ENVIRONMENT VARIABLES"
Packit 7cfc04
The following environment variables shall affect the execution of
Packit 7cfc04
.IR nohup :
Packit 7cfc04
.IP "\fIHOME\fP" 10
Packit 7cfc04
Determine the pathname of the user's home directory: if the output
Packit 7cfc04
file
Packit 7cfc04
.BR nohup.out
Packit 7cfc04
cannot be created in the current directory, the
Packit 7cfc04
.IR nohup
Packit 7cfc04
utility shall use the directory named by
Packit 7cfc04
.IR HOME
Packit 7cfc04
to create the file.
Packit 7cfc04
.IP "\fILANG\fP" 10
Packit 7cfc04
Provide a default value for the internationalization variables that are
Packit 7cfc04
unset or null. (See the Base Definitions volume of POSIX.1\(hy2008,
Packit 7cfc04
.IR "Section 8.2" ", " "Internationalization Variables"
Packit 7cfc04
for the precedence of internationalization variables used to determine
Packit 7cfc04
the values of locale categories.)
Packit 7cfc04
.IP "\fILC_ALL\fP" 10
Packit 7cfc04
If set to a non-empty string value, override the values of all the
Packit 7cfc04
other internationalization variables.
Packit 7cfc04
.IP "\fILC_CTYPE\fP" 10
Packit 7cfc04
Determine the locale for the interpretation of sequences of bytes of
Packit 7cfc04
text data as characters (for example, single-byte as opposed to
Packit 7cfc04
multi-byte characters in arguments).
Packit 7cfc04
.IP "\fILC_MESSAGES\fP" 10
Packit 7cfc04
.br
Packit 7cfc04
Determine the locale that should be used to affect the format and
Packit 7cfc04
contents of diagnostic messages written to standard error.
Packit 7cfc04
.IP "\fINLSPATH\fP" 10
Packit 7cfc04
Determine the location of message catalogs for the processing of
Packit 7cfc04
.IR LC_MESSAGES .
Packit 7cfc04
.IP "\fIPATH\fP" 10
Packit 7cfc04
Determine the search path that is used to locate the utility to be
Packit 7cfc04
invoked. See the Base Definitions volume of POSIX.1\(hy2008,
Packit 7cfc04
.IR "Chapter 8" ", " "Environment Variables".
Packit 7cfc04
.SH "ASYNCHRONOUS EVENTS"
Packit 7cfc04
The
Packit 7cfc04
.IR nohup
Packit 7cfc04
utility shall take the standard action for all signals except that
Packit 7cfc04
SIGHUP shall be ignored.
Packit 7cfc04
.SH STDOUT
Packit 7cfc04
If the standard output is not a terminal, the standard output of
Packit 7cfc04
.IR nohup
Packit 7cfc04
shall be the standard output generated by the execution of the
Packit 7cfc04
.IR utility
Packit 7cfc04
specified by the operands. Otherwise, nothing shall be written to the
Packit 7cfc04
standard output.
Packit 7cfc04
.SH STDERR
Packit 7cfc04
If the standard output is a terminal, a message shall be written to the
Packit 7cfc04
standard error, indicating the name of the file to which the output is
Packit 7cfc04
being appended. The name of the file shall be either
Packit 7cfc04
.BR nohup.out
Packit 7cfc04
or
Packit 7cfc04
.BR $HOME/nohup.out .
Packit 7cfc04
.SH "OUTPUT FILES"
Packit 7cfc04
Output written by the named utility is appended to the file
Packit 7cfc04
.BR nohup.out
Packit 7cfc04
(or
Packit 7cfc04
.BR $HOME/nohup.out ),
Packit 7cfc04
if the conditions hold as described in the DESCRIPTION.
Packit 7cfc04
.SH "EXTENDED DESCRIPTION"
Packit 7cfc04
None.
Packit 7cfc04
.SH "EXIT STATUS"
Packit 7cfc04
The following exit values shall be returned:
Packit 7cfc04
.IP 126 8
Packit 7cfc04
The utility specified by
Packit 7cfc04
.IR utility
Packit 7cfc04
was found but could not be invoked.
Packit 7cfc04
.IP 127 8
Packit 7cfc04
An error occurred in the
Packit 7cfc04
.IR nohup
Packit 7cfc04
utility or the utility specified by
Packit 7cfc04
.IR utility
Packit 7cfc04
could not be found.
Packit 7cfc04
.P
Packit 7cfc04
Otherwise, the exit status of
Packit 7cfc04
.IR nohup
Packit 7cfc04
shall be that of the utility specified by the
Packit 7cfc04
.IR utility
Packit 7cfc04
operand.
Packit 7cfc04
.SH "CONSEQUENCES OF ERRORS"
Packit 7cfc04
Default.
Packit 7cfc04
.LP
Packit 7cfc04
.IR "The following sections are informative."
Packit 7cfc04
.SH "APPLICATION USAGE"
Packit 7cfc04
The
Packit 7cfc04
.IR command ,
Packit 7cfc04
.IR env ,
Packit 7cfc04
.IR nice ,
Packit 7cfc04
.IR nohup ,
Packit 7cfc04
.IR time ,
Packit 7cfc04
and
Packit 7cfc04
.IR xargs
Packit 7cfc04
utilities have been specified to use exit code 127 if an error occurs
Packit 7cfc04
so that applications can distinguish ``failure to find a utility'' from
Packit 7cfc04
``invoked utility exited with an error indication''. The value 127 was
Packit 7cfc04
chosen because it is not commonly used for other meanings; most
Packit 7cfc04
utilities use small values for ``normal error conditions'' and the
Packit 7cfc04
values above 128 can be confused with termination due to receipt of a
Packit 7cfc04
signal. The value 126 was chosen in a similar manner to indicate that
Packit 7cfc04
the utility could be found, but not invoked. Some scripts produce
Packit 7cfc04
meaningful error messages differentiating the 126 and 127 cases. The
Packit 7cfc04
distinction between exit codes 126 and 127 is based on KornShell
Packit 7cfc04
practice that uses 127 when all attempts to
Packit 7cfc04
.IR exec
Packit 7cfc04
the utility fail with
Packit 7cfc04
.BR [ENOENT] ,
Packit 7cfc04
and uses 126 when any attempt to
Packit 7cfc04
.IR exec
Packit 7cfc04
the utility fails for any other reason.
Packit 7cfc04
.SH EXAMPLES
Packit 7cfc04
It is frequently desirable to apply
Packit 7cfc04
.IR nohup
Packit 7cfc04
to pipelines or lists of commands. This can be done by placing
Packit 7cfc04
pipelines and command lists in a single file; this file can then be
Packit 7cfc04
invoked as a utility, and the
Packit 7cfc04
.IR nohup
Packit 7cfc04
applies to everything in the file.
Packit 7cfc04
.P
Packit 7cfc04
Alternatively, the following command can be used to apply
Packit 7cfc04
.IR nohup
Packit 7cfc04
to a complex command:
Packit 7cfc04
.sp
Packit 7cfc04
.RS 4
Packit 7cfc04
.nf
Packit 7cfc04
\fB
Packit 7cfc04
nohup sh \(mic '\fIcomplex-command-line\fP' 
Packit 7cfc04
.fi \fR
Packit 7cfc04
.P
Packit 7cfc04
.RE
Packit 7cfc04
.SH RATIONALE
Packit 7cfc04
The 4.3 BSD version ignores SIGTERM and SIGHUP, and if
Packit 7cfc04
.BR ./nohup.out
Packit 7cfc04
cannot be used, it fails instead of trying to use
Packit 7cfc04
.BR $HOME/nohup.out .
Packit 7cfc04
.P
Packit 7cfc04
The
Packit 7cfc04
.IR csh
Packit 7cfc04
utility has a built-in version of
Packit 7cfc04
.IR nohup
Packit 7cfc04
that acts differently from the
Packit 7cfc04
.IR nohup
Packit 7cfc04
defined in this volume of POSIX.1\(hy2008.
Packit 7cfc04
.P
Packit 7cfc04
The term
Packit 7cfc04
.IR utility
Packit 7cfc04
is used, rather than
Packit 7cfc04
.IR command ,
Packit 7cfc04
to highlight the fact that shell compound commands, pipelines, special
Packit 7cfc04
built-ins, and so on, cannot be used directly.
Packit 7cfc04
However,
Packit 7cfc04
.IR utility
Packit 7cfc04
includes user application programs and shell scripts, not just the
Packit 7cfc04
standard utilities.
Packit 7cfc04
.P
Packit 7cfc04
Historical versions of the
Packit 7cfc04
.IR nohup
Packit 7cfc04
utility use default file creation semantics. Some more recent versions
Packit 7cfc04
use the permissions specified here as an added security precaution.
Packit 7cfc04
.P
Packit 7cfc04
Some historical implementations ignore SIGQUIT in addition to SIGHUP;
Packit 7cfc04
others ignore SIGTERM. An early proposal allowed, but did not require,
Packit 7cfc04
SIGQUIT to be ignored. Several reviewers objected that
Packit 7cfc04
.IR nohup
Packit 7cfc04
should only modify the handling of SIGHUP as required by this volume of POSIX.1\(hy2008.
Packit 7cfc04
.P
Packit 7cfc04
Historical versions of
Packit 7cfc04
.IR nohup
Packit 7cfc04
did not affect standard input, but that causes problems in the common
Packit 7cfc04
scenario where the user logs into a system, types the command:
Packit 7cfc04
.sp
Packit 7cfc04
.RS 4
Packit 7cfc04
.nf
Packit 7cfc04
\fB
Packit 7cfc04
nohup make &
Packit 7cfc04
.fi \fR
Packit 7cfc04
.P
Packit 7cfc04
.RE
Packit 7cfc04
.P
Packit 7cfc04
at the prompt, and then logs out. If standard input is not affected by
Packit 7cfc04
.IR nohup ,
Packit 7cfc04
the login session may not terminate for quite some time, since standard
Packit 7cfc04
input remains open until
Packit 7cfc04
.IR make
Packit 7cfc04
exits. To avoid this problem, POSIX.1\(hy2008 allows implementations to
Packit 7cfc04
redirect standard input if it is a terminal. Since the behavior is
Packit 7cfc04
implementation-defined, portable applications that may run into the
Packit 7cfc04
problem should redirect standard input themselves. For example,
Packit 7cfc04
instead of:
Packit 7cfc04
.sp
Packit 7cfc04
.RS 4
Packit 7cfc04
.nf
Packit 7cfc04
\fB
Packit 7cfc04
nohup make &
Packit 7cfc04
.fi \fR
Packit 7cfc04
.P
Packit 7cfc04
.RE
Packit 7cfc04
.P
Packit 7cfc04
an application can invoke:
Packit 7cfc04
.sp
Packit 7cfc04
.RS 4
Packit 7cfc04
.nf
Packit 7cfc04
\fB
Packit 7cfc04
nohup make 
Packit 7cfc04
.fi \fR
Packit 7cfc04
.P
Packit 7cfc04
.RE
Packit 7cfc04
.SH "FUTURE DIRECTIONS"
Packit 7cfc04
None.
Packit 7cfc04
.SH "SEE ALSO"
Packit 7cfc04
.IR "Chapter 2" ", " "Shell Command Language",
Packit 7cfc04
.IR "\fIsh\fR\^"
Packit 7cfc04
.P
Packit 7cfc04
The Base Definitions volume of POSIX.1\(hy2008,
Packit 7cfc04
.IR "Chapter 8" ", " "Environment Variables"
Packit 7cfc04
.P
Packit 7cfc04
The System Interfaces volume of POSIX.1\(hy2008,
Packit 7cfc04
.IR "\fIsignal\fR\^(\|)"
Packit 7cfc04
.SH COPYRIGHT
Packit 7cfc04
Portions of this text are reprinted and reproduced in electronic form
Packit 7cfc04
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
Packit 7cfc04
-- Portable Operating System Interface (POSIX), The Open Group Base
Packit 7cfc04
Specifications Issue 7, Copyright (C) 2013 by the Institute of
Packit 7cfc04
Electrical and Electronics Engineers, Inc and The Open Group.
Packit 7cfc04
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
Packit 7cfc04
event of any discrepancy between this version and the original IEEE and
Packit 7cfc04
The Open Group Standard, the original IEEE and The Open Group Standard
Packit 7cfc04
is the referee document. The original Standard can be obtained online at
Packit 7cfc04
http://www.unix.org/online.html .
Packit 7cfc04
Packit 7cfc04
Any typographical or formatting errors that appear
Packit 7cfc04
in this page are most likely
Packit 7cfc04
to have been introduced during the conversion of the source files to
Packit 7cfc04
man page format. To report such errors, see
Packit 7cfc04
https://www.kernel.org/doc/man-pages/reporting_bugs.html .