📄 nohup.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>nohup</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_1574"> </a>NAME</h4><blockquote>nohup - invoke a utility immune to hangups</blockquote><h4><a name = "tag_001_014_1575"> </a>SYNOPSIS</h4><blockquote><pre><code>nohup <i>utility </i><b>[</b><i>argument</i>...<b>]</b></code></pre></blockquote><h4><a name = "tag_001_014_1576"> </a>DESCRIPTION</h4><blockquote>The<i>nohup</i>utilitywill invoke the utility named by the<i>utility</i>operand with arguments supplied as the<i>argument</i>operands.At the time the named<i>utility</i>is invoked,the SIGHUP signal is set to be ignored.<p>If the standard output is a terminal,all output written by the named<i>utility</i>to its standard outputwill be appended to 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, theoutput will be appended to the end of the file<b>nohup.out</b>in the directory specified by the<i>HOME</i>environment variable.If neither file can be created or opened for appending,<i>utility</i>will not be invoked.If a file is created, the file'spermission bits will be set to S_IRUSR | S_IWUSR.<p>If the standard error is a terminal,all output written by the named<i>utility</i>to its standard errorwill be redirected to the same file descriptor as the standard output.</blockquote><h4><a name = "tag_001_014_1577"> </a>OPTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1578"> </a>OPERANDS</h4><blockquote>The following operands are supported:<dl compact><dt><i>utility</i><dd>The name of autility that is to be invoked.If the<i>utility</i>operand names any of the special built-in utilities in<xref href=sbi><a href="chap2.html#tag_001_014">Special Built-in Utilities</a></xref>,the results are undefined.<dt><i>argument</i><dd>Any string to be supplied as an argument when invoking theutility named by the<i>utility</i>operand.</dl></blockquote><h4><a name = "tag_001_014_1579"> </a>STDIN</h4><blockquote>Not used.</blockquote><h4><a name = "tag_001_014_1580"> </a>INPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1581"> </a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>nohup</i>:<dl compact><dt><i>HOME</i><dd>Determine the pathname of the user's home directory:if the output file<b>nohup.out</b>cannot be created in the currentdirectory, the<i>nohup</i>utility will use the directory named by<i>HOME</i>to create the file.<dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i><dt><i>PATH</i><dd>Determine the search paththat will be used to locate the utility to be invoked.Seethe <b>XBD</b> specification, <a href="../xbd/envvar.html"><b>Environment Variables</b> </a> .</dl></blockquote><h4><a name = "tag_001_014_1582"> </a>ASYNCHRONOUS EVENTS</h4><blockquote>The<i>nohup</i>utility will take thestandard action for all signalsexcept that SIGHUP will be ignored.</blockquote><h4><a name = "tag_001_014_1583"> </a>STDOUT</h4><blockquote>If the standard output is not a terminal, the standard output of<i>nohup</i>will be the standard output generated by the execution of the<i>utility</i>specified by the operands.Otherwise, nothing will be written to the standard output.</blockquote><h4><a name = "tag_001_014_1584"> </a>STDERR</h4><blockquote>If the standard output is a terminal,a message will be written to the standard error,indicating the name of the file to which the output is being appended.The name of the file will be either<b>nohup.out</b>or<b>$HOME/nohup.out</b>.</blockquote><h4><a name = "tag_001_014_1585"> </a>OUTPUT FILES</h4><blockquote>If the standard output is a terminal,all output written by the named<i>utility</i>to the standard outputand standard error is appended to the file<b>nohup.out</b>,which is created if it does not already exist.</blockquote><h4><a name = "tag_001_014_1586"> </a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1587"> </a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>126<dd>The utility specified by<i>utility</i>was found but could not be invoked.<dt>127<dd>An error occurred in the<i>nohup</i>utility or the utility specified by<i>utility</i>could not be found.</dl><p>Otherwise, the exit status of<i>nohup</i>will be that of theutility specified by the<i>utility</i>operand.</blockquote><h4><a name = "tag_001_014_1588"> </a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_1589"> </a>APPLICATION USAGE</h4><blockquote>The<i><a href="command.html">command</a></i>,<i><a href="env.html">env</a></i>,<i><a href="nice.html">nice</a></i>,<i>nohup</i>,<i><a href="time.html">time</a></i>and<i><a href="xargs.html">xargs</a></i>utilities have been specified to useexit code 127 if an error occurs so thatapplications can distinguish"failure to find a utility" from "invoked utility exitedwith an error indication".The value 127 was chosen because it is not commonly used for other meanings;most utilities use small values for "normal error conditions" andthe values above 128 can be confused with termination due to receipt of asignal.The value 126was chosen in a similar manner to indicate that the utilitycould be found, but not invoked.Some scripts produce meaningful error messagesdifferentiating the 126 and 127 cases.The distinction between exit codes 126 and 127 is basedon KornShell practice that uses 127 when all attempts to<i>exec</i>the utility fail with[ENOENT],and uses 126 when any attempt to<i>exec</i>the utility fails for any other reason.<br></blockquote><h4><a name = "tag_001_014_1590"> </a>EXAMPLES</h4><blockquote>It is frequently desirable to apply<i>nohup</i>to pipelines or lists of commands.This can be done by placing pipelinesand command lists in a single file; this file can then beinvoked as a utility, and the<i>nohup</i>applies to everything in the file.<p>Alternatively, the following command can be used to apply<i>nohup</i>to a complex command:<pre><code>nohup sh -c '<i>complex-command-line</i>'</code></pre></blockquote><h4><a name = "tag_001_014_1591"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1592"> </a>SEE ALSO</h4><blockquote><i><a href="sh.html">sh</a></i>,the <b>XSH</b> specification description of<i><a href="../xsh/signal.html">signal()</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -