1NOHUP(1P) POSIX Programmer's Manual NOHUP(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 nohup - invoke a utility immune to hangups
13
15 nohup utility [argument...]
16
18 The nohup utility shall invoke the utility named by the utility operand
19 with arguments supplied as the argument operands. At the time the named
20 utility is invoked, the SIGHUP signal shall be set to be ignored.
21
22 If the standard output is a terminal, all output written by the named
23 utility to its standard output shall be appended to the end of the file
24 nohup.out in the current directory. If nohup.out cannot be created or
25 opened for appending, the output shall be appended to the end of the
26 file nohup.out in the directory specified by the HOME environment vari‐
27 able. If neither file can be created or opened for appending, utility
28 shall not be invoked. If a file is created, the file's permission bits
29 shall be set to S_IRUSR | S_IWUSR.
30
31 If the standard error is a terminal, all output written by the named
32 utility to its standard error shall be redirected to the same file
33 descriptor as the standard output.
34
36 None.
37
39 The following operands shall be supported:
40
41 utility
42 The name of a utility that is to be invoked. If the utility op‐
43 erand names any of the special built-in utilities in Special
44 Built-In Utilities, the results are undefined.
45
46 argument
47 Any string to be supplied as an argument when invoking the util‐
48 ity named by the utility operand.
49
50
52 Not used.
53
55 None.
56
58 The following environment variables shall affect the execution of
59 nohup:
60
61 HOME Determine the pathname of the user's home directory: if the out‐
62 put file nohup.out cannot be created in the current directory,
63 the nohup utility shall use the directory named by HOME to cre‐
64 ate the file.
65
66 LANG Provide a default value for the internationalization variables
67 that are unset or null. (See the Base Definitions volume of
68 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
69 ables for the precedence of internationalization variables used
70 to determine the values of locale categories.)
71
72 LC_ALL If set to a non-empty string value, override the values of all
73 the other internationalization variables.
74
75 LC_CTYPE
76 Determine the locale for the interpretation of sequences of
77 bytes of text data as characters (for example, single-byte as
78 opposed to multi-byte characters in arguments).
79
80 LC_MESSAGES
81 Determine the locale that should be used to affect the format
82 and contents of diagnostic messages written to standard error.
83
84 NLSPATH
85 Determine the location of message catalogs for the processing of
86 LC_MESSAGES .
87
88 PATH Determine the search path that is used to locate the utility to
89 be invoked. See the Base Definitions volume of
90 IEEE Std 1003.1-2001, Chapter 8, Environment Variables.
91
92
94 The nohup utility shall take the standard action for all signals except
95 that SIGHUP shall be ignored.
96
98 If the standard output is not a terminal, the standard output of nohup
99 shall be the standard output generated by the execution of the utility
100 specified by the operands. Otherwise, nothing shall be written to the
101 standard output.
102
104 If the standard output is a terminal, a message shall be written to the
105 standard error, indicating the name of the file to which the output is
106 being appended. The name of the file shall be either nohup.out or
107 $HOME/nohup.out.
108
110 If the standard output is a terminal, all output written by the named
111 utility to the standard output and standard error is appended to the
112 file nohup.out, which is created if it does not already exist.
113
115 None.
116
118 The following exit values shall be returned:
119
120 126 The utility specified by utility was found but could not be
121 invoked.
122
123 127 An error occurred in the nohup utility or the utility specified
124 by utility could not be found.
125
126
127 Otherwise, the exit status of nohup shall be that of the utility speci‐
128 fied by the utility operand.
129
131 Default.
132
133 The following sections are informative.
134
136 The command, env, nice, nohup, time, and xargs utilities have been
137 specified to use exit code 127 if an error occurs so that applications
138 can distinguish "failure to find a utility" from "invoked utility
139 exited with an error indication". The value 127 was chosen because it
140 is not commonly used for other meanings; most utilities use small val‐
141 ues for "normal error conditions" and the values above 128 can be con‐
142 fused with termination due to receipt of a signal. The value 126 was
143 chosen in a similar manner to indicate that the utility could be found,
144 but not invoked. Some scripts produce meaningful error messages differ‐
145 entiating the 126 and 127 cases. The distinction between exit codes 126
146 and 127 is based on KornShell practice that uses 127 when all attempts
147 to exec the utility fail with [ENOENT], and uses 126 when any attempt
148 to exec the utility fails for any other reason.
149
151 It is frequently desirable to apply nohup to pipelines or lists of com‐
152 mands. This can be done by placing pipelines and command lists in a
153 single file; this file can then be invoked as a utility, and the nohup
154 applies to everything in the file.
155
156 Alternatively, the following command can be used to apply nohup to a
157 complex command:
158
159
160 nohup sh -c 'complex-command-line'
161
163 The 4.3 BSD version ignores SIGTERM and SIGHUP, and if ./nohup.out can‐
164 not be used, it fails instead of trying to use $HOME/nohup.out.
165
166 The csh utility has a built-in version of nohup that acts differently
167 from the nohup defined in this volume of IEEE Std 1003.1-2001.
168
169 The term utility is used, rather than command, to highlight the fact
170 that shell compound commands, pipelines, special built-ins, and so on,
171 cannot be used directly. However, utility includes user application
172 programs and shell scripts, not just the standard utilities.
173
174 Historical versions of the nohup utility use default file creation
175 semantics. Some more recent versions use the permissions specified here
176 as an added security precaution.
177
178 Some historical implementations ignore SIGQUIT in addition to SIGHUP;
179 others ignore SIGTERM. An early proposal allowed, but did not require,
180 SIGQUIT to be ignored. Several reviewers objected that nohup should
181 only modify the handling of SIGHUP as required by this volume of
182 IEEE Std 1003.1-2001.
183
185 None.
186
188 Shell Command Language, sh, the System Interfaces volume of
189 IEEE Std 1003.1-2001, signal()
190
192 Portions of this text are reprinted and reproduced in electronic form
193 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
194 -- Portable Operating System Interface (POSIX), The Open Group Base
195 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
196 Electrical and Electronics Engineers, Inc and The Open Group. In the
197 event of any discrepancy between this version and the original IEEE and
198 The Open Group Standard, the original IEEE and The Open Group Standard
199 is the referee document. The original Standard can be obtained online
200 at http://www.opengroup.org/unix/online.html .
201
202
203
204IEEE/The Open Group 2003 NOHUP(1P)