isposix

Un outil pour savoir si une commande est posix - retour accueil

git clone git://bebou.netlib.re/isposix

Log | Files | Refs | README |

nohup.html (14945B)


      1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved -->
      2 <!DOCTYPE HTML>
      3 <html lang="en">
      4 <head>
      5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0">
      6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 -->
      8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved -->
      9 <title>nohup</title>
     10 </head>
     11 <body bgcolor="white">
     12 <div class="NAVHEADER">
     13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
     14 <tr class="nav">
     15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/nm.html" accesskey="P">&lt;&lt;&lt;
     16 Previous</a></td>
     17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
     18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/od.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
     19 </tr>
     20 </table>
     21 <hr align="left" width="100%"></div>
     22 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3">
     23 <center><font size="2">The Open Group Base Specifications Issue 8<br>
     24 IEEE Std 1003.1-2024<br>
     25 Copyright © 2001-2024 The IEEE and The Open Group</font></center>
     26 <hr size="2" noshade>
     27 <a name="top" id="top"></a> <a name="nohup" id="nohup"></a> <a name="tag_20_89" id="tag_20_89"></a><!-- nohup -->
     28 <h4 class="mansect"><a name="tag_20_89_01" id="tag_20_89_01"></a>NAME</h4>
     29 <blockquote>nohup — invoke a utility immune to hangups</blockquote>
     30 <h4 class="mansect"><a name="tag_20_89_02" id="tag_20_89_02"></a>SYNOPSIS</h4>
     31 <blockquote class="synopsis">
     32 <p><code><tt>nohup</tt> <i>utility</i> <b>[</b><i>argument</i><tt>...</tt><b>]</b></code></p>
     33 </blockquote>
     34 <h4 class="mansect"><a name="tag_20_89_03" id="tag_20_89_03"></a>DESCRIPTION</h4>
     35 <blockquote>
     36 <p>The <i>nohup</i> utility shall invoke the utility named by the <i>utility</i> operand with arguments supplied as the
     37 <i>argument</i> operands. At the time the named <i>utility</i> is invoked, the SIGHUP signal shall be set to be ignored.</p>
     38 <p>If standard input is associated with a terminal, the <i>nohup</i> utility may redirect standard input from an unspecified
     39 file.</p>
     40 <p>If the standard output is a terminal, all output written by the named <i>utility</i> to its standard output shall be appended to
     41 the end of the file <b>nohup.out</b> in the current directory. If <b>nohup.out</b> cannot be created or opened for appending, the
     42 output shall be appended to the end of the file <b>nohup.out</b> in the directory specified by the <i>HOME</i> environment
     43 variable. If neither file can be created or opened for appending, <i>utility</i> shall not be invoked. If a file is created, the
     44 file's permission bits shall be set to S_IRUSR | S_IWUSR.</p>
     45 <p>If standard error is a terminal and standard output is open but is not a terminal, all output written by the named utility to
     46 its standard error shall be redirected to the same open file description as the standard output. If standard error is a terminal
     47 and standard output either is a terminal or is closed, the same output shall instead be appended to the end of the <b>nohup.out</b>
     48 file as described above.</p>
     49 </blockquote>
     50 <h4 class="mansect"><a name="tag_20_89_04" id="tag_20_89_04"></a>OPTIONS</h4>
     51 <blockquote>
     52 <p>None.</p>
     53 </blockquote>
     54 <h4 class="mansect"><a name="tag_20_89_05" id="tag_20_89_05"></a>OPERANDS</h4>
     55 <blockquote>
     56 <p>The following operands shall be supported:</p>
     57 <dl compact>
     58 <dd></dd>
     59 <dt><i>utility</i></dt>
     60 <dd>The name of a utility that is to be invoked. If the <i>utility</i> operand names any of the special built-in utilities in
     61 <a href="../utilities/V3_chap02.html#tag_19_15"><i>2.15 Special Built-In Utilities</i></a> , the results are undefined.</dd>
     62 <dt><i>argument</i></dt>
     63 <dd>Any string to be supplied as an argument when invoking the utility named by the <i>utility</i> operand.</dd>
     64 </dl>
     65 </blockquote>
     66 <h4 class="mansect"><a name="tag_20_89_06" id="tag_20_89_06"></a>STDIN</h4>
     67 <blockquote>
     68 <p>Not used.</p>
     69 </blockquote>
     70 <h4 class="mansect"><a name="tag_20_89_07" id="tag_20_89_07"></a>INPUT FILES</h4>
     71 <blockquote>
     72 <p>None.</p>
     73 </blockquote>
     74 <h4 class="mansect"><a name="tag_20_89_08" id="tag_20_89_08"></a>ENVIRONMENT VARIABLES</h4>
     75 <blockquote>
     76 <p>The following environment variables shall affect the execution of <i>nohup</i>:</p>
     77 <dl compact>
     78 <dd></dd>
     79 <dt><i>HOME</i></dt>
     80 <dd>Determine the pathname of the user's home directory: if the output file <b>nohup.out</b> cannot be created in the current
     81 directory, the <i>nohup</i> utility shall use the directory named by <i>HOME</i> to create the file.</dd>
     82 <dt><i>LANG</i></dt>
     83 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
     84 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
     85 variables used to determine the values of locale categories.)</dd>
     86 <dt><i>LC_ALL</i></dt>
     87 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
     88 <dt><i>LC_CTYPE</i></dt>
     89 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
     90 opposed to multi-byte characters in arguments).</dd>
     91 <dt><i>LC_MESSAGES</i></dt>
     92 <dd><br>
     93 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
     94 <dt><i>NLSPATH</i></dt>
     95 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     96 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
     97 "0"></dd>
     98 <dt><i>PATH</i></dt>
     99 <dd>Determine the search path that is used to locate the utility to be invoked. See XBD <a href=
    100 "../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> .</dd>
    101 </dl>
    102 </blockquote>
    103 <h4 class="mansect"><a name="tag_20_89_09" id="tag_20_89_09"></a>ASYNCHRONOUS EVENTS</h4>
    104 <blockquote>
    105 <p>The <i>nohup</i> utility shall take the standard action for all signals except that SIGHUP shall be ignored.</p>
    106 </blockquote>
    107 <h4 class="mansect"><a name="tag_20_89_10" id="tag_20_89_10"></a>STDOUT</h4>
    108 <blockquote>
    109 <p>If the standard output is not a terminal, the standard output of <i>nohup</i> shall be the standard output generated by the
    110 execution of the <i>utility</i> specified by the operands. Otherwise, nothing shall be written to the standard output.</p>
    111 </blockquote>
    112 <h4 class="mansect"><a name="tag_20_89_11" id="tag_20_89_11"></a>STDERR</h4>
    113 <blockquote>
    114 <p>If the standard output is a terminal, a message shall be written to the standard error, indicating the name of the file to which
    115 the output is being appended. The name of the file shall be either <b>nohup.out</b> or <b>$HOME/nohup.out</b>.</p>
    116 </blockquote>
    117 <h4 class="mansect"><a name="tag_20_89_12" id="tag_20_89_12"></a>OUTPUT FILES</h4>
    118 <blockquote>
    119 <p>Output written by the named utility is appended to the file <b>nohup.out</b> (or <b>$HOME/nohup.out</b>), if the conditions hold
    120 as described in the DESCRIPTION.</p>
    121 </blockquote>
    122 <h4 class="mansect"><a name="tag_20_89_13" id="tag_20_89_13"></a>EXTENDED DESCRIPTION</h4>
    123 <blockquote>
    124 <p>None.</p>
    125 </blockquote>
    126 <h4 class="mansect"><a name="tag_20_89_14" id="tag_20_89_14"></a>EXIT STATUS</h4>
    127 <blockquote>
    128 <p>The following exit values shall be returned:</p>
    129 <dl compact>
    130 <dd></dd>
    131 <dt>126</dt>
    132 <dd>The utility specified by <i>utility</i> was found but could not be invoked.</dd>
    133 <dt>127</dt>
    134 <dd>An error occurred in the <i>nohup</i> utility or the utility specified by <i>utility</i> could not be found.</dd>
    135 </dl>
    136 <p>Otherwise, the exit status of <i>nohup</i> shall be that of the utility specified by the <i>utility</i> operand.</p>
    137 </blockquote>
    138 <h4 class="mansect"><a name="tag_20_89_15" id="tag_20_89_15"></a>CONSEQUENCES OF ERRORS</h4>
    139 <blockquote>
    140 <p>Default.</p>
    141 </blockquote>
    142 <hr>
    143 <div class="box"><em>The following sections are informative.</em></div>
    144 <h4 class="mansect"><a name="tag_20_89_16" id="tag_20_89_16"></a>APPLICATION USAGE</h4>
    145 <blockquote>
    146 <p>The <a href="../utilities/command.html"><i>command</i></a>, <a href="../utilities/env.html"><i>env</i></a>, <a href=
    147 "../utilities/nice.html"><i>nice</i></a>, <i>nohup</i>, <a href="../utilities/time.html"><i>time</i></a>, <a href=
    148 "../utilities/timeout.html"><i>timeout</i></a>, and <a href="../utilities/xargs.html"><i>xargs</i></a> utilities have been
    149 specified to use exit code 127 if a utility to be invoked cannot be found, so that applications can distinguish &quot;failure to find a
    150 utility&quot; from &quot;invoked utility exited with an error indication&quot;. However, the <a href=
    151 "../utilities/command.html"><i>command</i></a> and <i>nohup</i> utilities also use exit code 127 when an error occurs in those
    152 utilities, which means exit code 127 is not universally a &quot;not found&quot; indicator. The value 127 was chosen because it is not
    153 commonly used for other meanings; most utilities use small values for &quot;normal error conditions&quot; and the values above 128 can be
    154 confused with termination due to receipt of a signal. The value 126 was chosen in a similar manner to indicate that the utility
    155 could be found, but not invoked. Some scripts produce meaningful error messages differentiating the 126 and 127 cases. The
    156 distinction between exit codes 126 and 127 is based on KornShell practice that uses 127 when all attempts to <i>exec</i> the
    157 utility fail with [ENOENT], and uses 126 when any attempt to <i>exec</i> the utility fails for any other reason.</p>
    158 </blockquote>
    159 <h4 class="mansect"><a name="tag_20_89_17" id="tag_20_89_17"></a>EXAMPLES</h4>
    160 <blockquote>
    161 <p>It is frequently desirable to apply <i>nohup</i> to pipelines or lists of commands. This can be done by placing pipelines and
    162 command lists in a single file; this file can then be invoked as a utility, and the <i>nohup</i> applies to everything in the
    163 file.</p>
    164 <p>Alternatively, the following command can be used to apply <i>nohup</i> to a complex command:</p>
    165 <pre>
    166 <tt>nohup sh -c -- '</tt><i>complex-command-line</i><tt>' &lt;/dev/null
    167 </tt></pre></blockquote>
    168 <h4 class="mansect"><a name="tag_20_89_18" id="tag_20_89_18"></a>RATIONALE</h4>
    169 <blockquote>
    170 <p>The 4.3 BSD version ignores SIGTERM and SIGHUP, and if <b>./nohup.out</b> cannot be used, it fails instead of trying to use
    171 <b>$HOME/nohup.out</b>.</p>
    172 <p>The <i>csh</i> utility has a built-in version of <i>nohup</i> that acts differently from the <i>nohup</i> defined in this volume
    173 of POSIX.1-2024.</p>
    174 <p>The term <i>utility</i> is used, rather than <i>command</i>, to highlight the fact that shell compound commands, pipelines,
    175 special built-ins, and so on, cannot be used directly. However, <i>utility</i> includes user application programs and shell
    176 scripts, not just the standard utilities.</p>
    177 <p>Historical versions of the <i>nohup</i> utility use default file creation semantics. Some more recent versions use the
    178 permissions specified here as an added security precaution.</p>
    179 <p>Some historical implementations ignore SIGQUIT in addition to SIGHUP; others ignore SIGTERM. An early proposal allowed, but did
    180 not require, SIGQUIT to be ignored. Several reviewers objected that <i>nohup</i> should only modify the handling of SIGHUP as
    181 required by this volume of POSIX.1-2024.</p>
    182 <p>Historical versions of <i>nohup</i> did not affect standard input, but that causes problems in the common scenario where the
    183 user logs into a system, types the command:</p>
    184 <pre>
    185 <tt>nohup make &
    186 </tt></pre>
    187 <p>at the prompt, and then logs out. If standard input is not affected by <i>nohup</i>, the login session may not terminate for
    188 quite some time, since standard input remains open until <a href="../utilities/make.html"><i>make</i></a> exits. To avoid this
    189 problem, POSIX.1-2024 allows implementations to redirect standard input if it is a terminal. Since the behavior is
    190 implementation-defined, portable applications that may run into the problem should redirect standard input themselves. For example,
    191 instead of:</p>
    192 <pre>
    193 <tt>nohup make &
    194 </tt></pre>
    195 <p>an application can invoke:</p>
    196 <pre>
    197 <tt>nohup make &lt;/dev/null &
    198 </tt></pre></blockquote>
    199 <h4 class="mansect"><a name="tag_20_89_19" id="tag_20_89_19"></a>FUTURE DIRECTIONS</h4>
    200 <blockquote>
    201 <p>None.</p>
    202 </blockquote>
    203 <h4 class="mansect"><a name="tag_20_89_20" id="tag_20_89_20"></a>SEE ALSO</h4>
    204 <blockquote>
    205 <p><a href="../utilities/V3_chap02.html#tag_19"><i>2. Shell Command Language</i></a> , <a href=
    206 "../utilities/sh.html#"><i>sh</i></a></p>
    207 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a></p>
    208 <p>XSH <a href="../functions/signal.html#"><i>signal</i></a></p>
    209 </blockquote>
    210 <h4 class="mansect"><a name="tag_20_89_21" id="tag_20_89_21"></a>CHANGE HISTORY</h4>
    211 <blockquote>
    212 <p>First released in Issue 2.</p>
    213 </blockquote>
    214 <h4 class="mansect"><a name="tag_20_89_22" id="tag_20_89_22"></a>Issue 7</h4>
    215 <blockquote>
    216 <p>Austin Group Interpretations 1003.1-2001 #104, #105, and #106 are applied.</p>
    217 </blockquote>
    218 <h4 class="mansect"><a name="tag_20_89_23" id="tag_20_89_23"></a>Issue 8</h4>
    219 <blockquote>
    220 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    221 <p>Austin Group Defect 1530 is applied, changing &quot;<tt>sh -c</tt>&quot; to &quot;<tt>sh -c --</tt>&quot;.</p>
    222 <p>Austin Group Defect 1586 is applied, adding the <a href="../utilities/timeout.html"><i>timeout</i></a> utility.</p>
    223 <p>Austin Group Defect 1594 is applied, changing the APPLICATION USAGE section.</p>
    224 </blockquote>
    225 <div class="box"><em>End of informative text.</em></div>
    226 <hr>
    227 <p>&nbsp;</p>
    228 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    229 <hr size="2" noshade>
    230 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    231 POSIX™ is a Trademark of The IEEE.<br>
    232 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    233 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    234 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    235 ]</font></center>
    236 <hr size="2" noshade>
    237 <div class="NAVHEADER">
    238 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    239 <tr class="nav">
    240 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/nm.html" accesskey="P">&lt;&lt;&lt;
    241 Previous</a></td>
    242 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    243 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/od.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
    244 </tr>
    245 </table>
    246 <hr align="left" width="100%"></div>
    247 </body>
    248 </html>