1NOHUP(P)                   POSIX Programmer's Manual                  NOHUP(P)
2
3
4

NAME

6       nohup - invoke a utility immune to hangups
7

SYNOPSIS

9       nohup utility [argument...]
10

DESCRIPTION

12       The nohup utility shall invoke the utility named by the utility operand
13       with arguments supplied as the argument operands. At the time the named
14       utility is invoked, the SIGHUP signal shall be set to be ignored.
15
16       If  the  standard output is a terminal, all output written by the named
17       utility to its standard output shall be appended to the end of the file
18       nohup.out  in  the current directory. If nohup.out cannot be created or
19       opened for appending, the output shall be appended to the  end  of  the
20       file nohup.out in the directory specified by the HOME environment vari‐
21       able. If neither file can be created or opened for  appending,  utility
22       shall  not be invoked. If a file is created, the file's permission bits
23       shall be set to S_IRUSR | S_IWUSR.
24
25       If the standard error is a terminal, all output written  by  the  named
26       utility  to  its  standard  error  shall be redirected to the same file
27       descriptor as the standard output.
28

OPTIONS

30       None.
31

OPERANDS

33       The following operands shall be supported:
34
35       utility
36              The name of a utility that is to be invoked. If the utility  op‐
37              erand  names  any  of  the special built-in utilities in Special
38              Built-In Utilities , the results are undefined.
39
40       argument
41              Any string to be supplied as an argument when invoking the util‐
42              ity named by the utility operand.
43
44

STDIN

46       Not used.
47

INPUT FILES

49       None.
50

ENVIRONMENT VARIABLES

52       The  following  environment  variables  shall  affect  the execution of
53       nohup:
54
55       HOME   Determine the pathname of the user's home directory: if the out‐
56              put  file  nohup.out cannot be created in the current directory,
57              the nohup utility shall use the directory named by HOME to  cre‐
58              ate the file.
59
60       LANG   Provide  a  default value for the internationalization variables
61              that are unset or null. (See  the  Base  Definitions  volume  of
62              IEEE Std 1003.1-2001,  Section  8.2,  Internationalization Vari‐
63              ables for the precedence of internationalization variables  used
64              to determine the values of locale categories.)
65
66       LC_ALL If  set  to a non-empty string value, override the values of all
67              the other internationalization variables.
68
69       LC_CTYPE
70              Determine the locale for  the  interpretation  of  sequences  of
71              bytes  of  text  data as characters (for example, single-byte as
72              opposed to multi-byte characters in arguments).
73
74       LC_MESSAGES
75              Determine the locale that should be used to  affect  the  format
76              and contents of diagnostic messages written to standard error.
77
78       NLSPATH
79              Determine the location of message catalogs for the processing of
80              LC_MESSAGES .
81
82       PATH   Determine the search path that is used to locate the utility  to
83              be    invoked.    See    the    Base   Definitions   volume   of
84              IEEE Std 1003.1-2001, Chapter 8, Environment Variables.
85
86

ASYNCHRONOUS EVENTS

88       The nohup utility shall take the standard action for all signals except
89       that SIGHUP shall be ignored.
90

STDOUT

92       If  the standard output is not a terminal, the standard output of nohup
93       shall be the standard output generated by the execution of the  utility
94       specified  by  the operands. Otherwise, nothing shall be written to the
95       standard output.
96

STDERR

98       If the standard output is a terminal, a message shall be written to the
99       standard  error, indicating the name of the file to which the output is
100       being appended. The name of the  file  shall  be  either  nohup.out  or
101       $HOME/nohup.out.
102

OUTPUT FILES

104       If  the  standard output is a terminal, all output written by the named
105       utility to the standard output and standard error is  appended  to  the
106       file nohup.out, which is created if it does not already exist.
107

EXTENDED DESCRIPTION

109       None.
110

EXIT STATUS

112       The following exit values shall be returned:
113
114       126    The  utility  specified  by  utility  was found but could not be
115              invoked.
116
117       127    An error occurred in the nohup utility or the utility  specified
118              by utility could not be found.
119
120
121       Otherwise, the exit status of nohup shall be that of the utility speci‐
122       fied by the utility operand.
123

CONSEQUENCES OF ERRORS

125       Default.
126
127       The following sections are informative.
128

APPLICATION USAGE

130       The command, env, nice, nohup, time,  and  xargs  utilities  have  been
131       specified  to use exit code 127 if an error occurs so that applications
132       can distinguish "failure to  find  a  utility"  from  "invoked  utility
133       exited  with  an error indication". The value 127 was chosen because it
134       is not commonly used for other meanings; most utilities use small  val‐
135       ues  for "normal error conditions" and the values above 128 can be con‐
136       fused with termination due to receipt of a signal. The  value  126  was
137       chosen in a similar manner to indicate that the utility could be found,
138       but not invoked. Some scripts produce meaningful error messages differ‐
139       entiating the 126 and 127 cases. The distinction between exit codes 126
140       and 127 is based on KornShell practice that uses 127 when all  attempts
141       to  exec  the utility fail with [ENOENT], and uses 126 when any attempt
142       to exec the utility fails for any other reason.
143

EXAMPLES

145       It is frequently desirable to apply nohup to pipelines or lists of com‐
146       mands.  This  can  be  done by placing pipelines and command lists in a
147       single file; this file can then be invoked as a utility, and the  nohup
148       applies to everything in the file.
149
150       Alternatively,  the  following  command can be used to apply nohup to a
151       complex command:
152
153
154              nohup sh -c 'complex-command-line'
155

RATIONALE

157       The 4.3 BSD version ignores SIGTERM and SIGHUP, and if ./nohup.out can‐
158       not be used, it fails instead of trying to use $HOME/nohup.out.
159
160       The  csh  utility has a built-in version of nohup that acts differently
161       from the nohup defined in this volume of IEEE Std 1003.1-2001.
162
163       The term utility is used, rather than command, to  highlight  the  fact
164       that  shell compound commands, pipelines, special built-ins, and so on,
165       cannot be used directly. However,  utility  includes  user  application
166       programs and shell scripts, not just the standard utilities.
167
168       Historical  versions  of  the  nohup  utility use default file creation
169       semantics. Some more recent versions use the permissions specified here
170       as an added security precaution.
171
172       Some  historical  implementations ignore SIGQUIT in addition to SIGHUP;
173       others ignore SIGTERM. An early proposal allowed, but did not  require,
174       SIGQUIT  to  be  ignored.  Several reviewers objected that nohup should
175       only modify the handling of  SIGHUP  as  required  by  this  volume  of
176       IEEE Std 1003.1-2001.
177

FUTURE DIRECTIONS

179       None.
180

SEE ALSO

182       Shell  Command  Language  ,  sh  ,  the  System  Interfaces  volume  of
183       IEEE Std 1003.1-2001, signal()
184
186       Portions of this text are reprinted and reproduced in  electronic  form
187       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
188       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
189       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
190       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
191       event of any discrepancy between this version and the original IEEE and
192       The Open Group Standard, the original IEEE and The Open Group  Standard
193       is  the  referee document. The original Standard can be obtained online
194       at http://www.opengroup.org/unix/online.html .
195
196
197
198IEEE/The Open Group                  2003                             NOHUP(P)
Impressum