logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

nohup.1p (9419B)


  1. '\" et
  2. .TH NOHUP "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. nohup
  12. \(em invoke a utility immune to hangups
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. nohup \fIutility \fB[\fIargument\fR...\fB]\fR
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR nohup
  21. utility shall invoke the utility named by the
  22. .IR utility
  23. operand with arguments supplied as the
  24. .IR argument
  25. operands. At the time the named
  26. .IR utility
  27. is invoked, the SIGHUP signal shall be set to be ignored.
  28. .P
  29. If standard input is associated with a terminal, the
  30. .IR nohup
  31. utility may redirect standard input from an unspecified file.
  32. .P
  33. If the standard output is a terminal, all output written by the named
  34. .IR utility
  35. to its standard output shall be appended to the end of the file
  36. .BR nohup.out
  37. in the current directory. If
  38. .BR nohup.out
  39. cannot be created or opened for appending, the output shall be appended
  40. to the end of the file
  41. .BR nohup.out
  42. in the directory specified by the
  43. .IR HOME
  44. environment variable. If neither file can be created or opened for
  45. appending,
  46. .IR utility
  47. shall not be invoked. If a file is created, the file's permission bits
  48. shall be set to S_IRUSR | S_IWUSR.
  49. .P
  50. If standard error is a terminal and standard output is open but is not
  51. a terminal, all output written by the named utility to its standard
  52. error shall be redirected to the same open file description as the
  53. standard output. If standard error is a terminal and standard output
  54. either is a terminal or is closed, the same output shall instead be
  55. appended to the end of the
  56. .BR nohup.out
  57. file as described above.
  58. .SH OPTIONS
  59. None.
  60. .SH OPERANDS
  61. The following operands shall be supported:
  62. .IP "\fIutility\fR" 10
  63. The name of a utility that is to be invoked. If the
  64. .IR utility
  65. operand names any of the special built-in utilities in
  66. .IR "Section 2.14" ", " "Special Built-In Utilities",
  67. the results are undefined.
  68. .IP "\fIargument\fR" 10
  69. Any string to be supplied as an argument when invoking the utility
  70. named by the
  71. .IR utility
  72. operand.
  73. .SH STDIN
  74. Not used.
  75. .SH "INPUT FILES"
  76. None.
  77. .SH "ENVIRONMENT VARIABLES"
  78. The following environment variables shall affect the execution of
  79. .IR nohup :
  80. .IP "\fIHOME\fP" 10
  81. Determine the pathname of the user's home directory: if the output
  82. file
  83. .BR nohup.out
  84. cannot be created in the current directory, the
  85. .IR nohup
  86. utility shall use the directory named by
  87. .IR HOME
  88. to create the file.
  89. .IP "\fILANG\fP" 10
  90. Provide a default value for the internationalization variables that are
  91. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  92. .IR "Section 8.2" ", " "Internationalization Variables"
  93. for the precedence of internationalization variables used to determine
  94. the values of locale categories.)
  95. .IP "\fILC_ALL\fP" 10
  96. If set to a non-empty string value, override the values of all the
  97. other internationalization variables.
  98. .IP "\fILC_CTYPE\fP" 10
  99. Determine the locale for the interpretation of sequences of bytes of
  100. text data as characters (for example, single-byte as opposed to
  101. multi-byte characters in arguments).
  102. .IP "\fILC_MESSAGES\fP" 10
  103. .br
  104. Determine the locale that should be used to affect the format and
  105. contents of diagnostic messages written to standard error.
  106. .IP "\fINLSPATH\fP" 10
  107. Determine the location of message catalogs for the processing of
  108. .IR LC_MESSAGES .
  109. .IP "\fIPATH\fP" 10
  110. Determine the search path that is used to locate the utility to be
  111. invoked. See the Base Definitions volume of POSIX.1\(hy2017,
  112. .IR "Chapter 8" ", " "Environment Variables".
  113. .SH "ASYNCHRONOUS EVENTS"
  114. The
  115. .IR nohup
  116. utility shall take the standard action for all signals except that
  117. SIGHUP shall be ignored.
  118. .SH STDOUT
  119. If the standard output is not a terminal, the standard output of
  120. .IR nohup
  121. shall be the standard output generated by the execution of the
  122. .IR utility
  123. specified by the operands. Otherwise, nothing shall be written to the
  124. standard output.
  125. .SH STDERR
  126. If the standard output is a terminal, a message shall be written to the
  127. standard error, indicating the name of the file to which the output is
  128. being appended. The name of the file shall be either
  129. .BR nohup.out
  130. or
  131. .BR $HOME/nohup.out .
  132. .SH "OUTPUT FILES"
  133. Output written by the named utility is appended to the file
  134. .BR nohup.out
  135. (or
  136. .BR $HOME/nohup.out ),
  137. if the conditions hold as described in the DESCRIPTION.
  138. .SH "EXTENDED DESCRIPTION"
  139. None.
  140. .SH "EXIT STATUS"
  141. The following exit values shall be returned:
  142. .IP 126 8
  143. The utility specified by
  144. .IR utility
  145. was found but could not be invoked.
  146. .IP 127 8
  147. An error occurred in the
  148. .IR nohup
  149. utility or the utility specified by
  150. .IR utility
  151. could not be found.
  152. .P
  153. Otherwise, the exit status of
  154. .IR nohup
  155. shall be that of the utility specified by the
  156. .IR utility
  157. operand.
  158. .SH "CONSEQUENCES OF ERRORS"
  159. Default.
  160. .LP
  161. .IR "The following sections are informative."
  162. .SH "APPLICATION USAGE"
  163. The
  164. .IR command ,
  165. .IR env ,
  166. .IR nice ,
  167. .IR nohup ,
  168. .IR time ,
  169. and
  170. .IR xargs
  171. utilities have been specified to use exit code 127 if an error occurs
  172. so that applications can distinguish ``failure to find a utility'' from
  173. ``invoked utility exited with an error indication''. The value 127 was
  174. chosen because it is not commonly used for other meanings; most
  175. utilities use small values for ``normal error conditions'' and the
  176. values above 128 can be confused with termination due to receipt of a
  177. signal. The value 126 was chosen in a similar manner to indicate that
  178. the utility could be found, but not invoked. Some scripts produce
  179. meaningful error messages differentiating the 126 and 127 cases. The
  180. distinction between exit codes 126 and 127 is based on KornShell
  181. practice that uses 127 when all attempts to
  182. .IR exec
  183. the utility fail with
  184. .BR [ENOENT] ,
  185. and uses 126 when any attempt to
  186. .IR exec
  187. the utility fails for any other reason.
  188. .SH EXAMPLES
  189. It is frequently desirable to apply
  190. .IR nohup
  191. to pipelines or lists of commands. This can be done by placing
  192. pipelines and command lists in a single file; this file can then be
  193. invoked as a utility, and the
  194. .IR nohup
  195. applies to everything in the file.
  196. .P
  197. Alternatively, the following command can be used to apply
  198. .IR nohup
  199. to a complex command:
  200. .sp
  201. .RS 4
  202. .nf
  203. nohup sh -c \(aq\fIcomplex-command-line\fP\(aq </dev/null
  204. .fi
  205. .P
  206. .RE
  207. .SH RATIONALE
  208. The 4.3 BSD version ignores SIGTERM and SIGHUP, and if
  209. .BR ./nohup.out
  210. cannot be used, it fails instead of trying to use
  211. .BR $HOME/nohup.out .
  212. .P
  213. The
  214. .IR csh
  215. utility has a built-in version of
  216. .IR nohup
  217. that acts differently from the
  218. .IR nohup
  219. defined in this volume of POSIX.1\(hy2017.
  220. .P
  221. The term
  222. .IR utility
  223. is used, rather than
  224. .IR command ,
  225. to highlight the fact that shell compound commands, pipelines, special
  226. built-ins, and so on, cannot be used directly.
  227. However,
  228. .IR utility
  229. includes user application programs and shell scripts, not just the
  230. standard utilities.
  231. .P
  232. Historical versions of the
  233. .IR nohup
  234. utility use default file creation semantics. Some more recent versions
  235. use the permissions specified here as an added security precaution.
  236. .P
  237. Some historical implementations ignore SIGQUIT in addition to SIGHUP;
  238. others ignore SIGTERM. An early proposal allowed, but did not require,
  239. SIGQUIT to be ignored. Several reviewers objected that
  240. .IR nohup
  241. should only modify the handling of SIGHUP as required by this volume of POSIX.1\(hy2017.
  242. .P
  243. Historical versions of
  244. .IR nohup
  245. did not affect standard input, but that causes problems in the common
  246. scenario where the user logs into a system, types the command:
  247. .sp
  248. .RS 4
  249. .nf
  250. nohup make &
  251. .fi
  252. .P
  253. .RE
  254. .P
  255. at the prompt, and then logs out. If standard input is not affected by
  256. .IR nohup ,
  257. the login session may not terminate for quite some time, since standard
  258. input remains open until
  259. .IR make
  260. exits. To avoid this problem, POSIX.1\(hy2008 allows implementations to
  261. redirect standard input if it is a terminal. Since the behavior is
  262. implementation-defined, portable applications that may run into the
  263. problem should redirect standard input themselves. For example,
  264. instead of:
  265. .sp
  266. .RS 4
  267. .nf
  268. nohup make &
  269. .fi
  270. .P
  271. .RE
  272. .P
  273. an application can invoke:
  274. .sp
  275. .RS 4
  276. .nf
  277. nohup make </dev/null &
  278. .fi
  279. .P
  280. .RE
  281. .SH "FUTURE DIRECTIONS"
  282. None.
  283. .SH "SEE ALSO"
  284. .IR "Chapter 2" ", " "Shell Command Language",
  285. .IR "\fIsh\fR\^"
  286. .P
  287. The Base Definitions volume of POSIX.1\(hy2017,
  288. .IR "Chapter 8" ", " "Environment Variables"
  289. .P
  290. The System Interfaces volume of POSIX.1\(hy2017,
  291. .IR "\fIsignal\fR\^(\|)"
  292. .\"
  293. .SH COPYRIGHT
  294. Portions of this text are reprinted and reproduced in electronic form
  295. from IEEE Std 1003.1-2017, Standard for Information Technology
  296. -- Portable Operating System Interface (POSIX), The Open Group Base
  297. Specifications Issue 7, 2018 Edition,
  298. Copyright (C) 2018 by the Institute of
  299. Electrical and Electronics Engineers, Inc and The Open Group.
  300. In the event of any discrepancy between this version and the original IEEE and
  301. The Open Group Standard, the original IEEE and The Open Group Standard
  302. is the referee document. The original Standard can be obtained online at
  303. http://www.opengroup.org/unix/online.html .
  304. .PP
  305. Any typographical or formatting errors that appear
  306. in this page are most likely
  307. to have been introduced during the conversion of the source files to
  308. man page format. To report such errors, see
  309. https://www.kernel.org/doc/man-pages/reporting_bugs.html .