📄 nice.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>nice</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_1517"> </a>NAME</h4><blockquote>nice - invoke a utility with an altered system scheduling priority</blockquote><h4><a name = "tag_001_014_1518"> </a>SYNOPSIS</h4><blockquote><pre><code>nice <b>[</b>-n <i>increment</i><b>] </b><i>utility </i><b>[</b><i>argument</i>...<b>]</b>nice <b>[</b>-<i>increment</i><b>] </b><i>utility </i><b>[</b><i>argument</i>...<b>]</b></code></pre></blockquote><h4><a name = "tag_001_014_1519"> </a>DESCRIPTION</h4><blockquote>The<i>nice</i>utility invokes a utility, requesting that it berun with a different system scheduling priority (seethe definition of<b>system scheduling priority</b>in the <b>XBD</b> specification, <a href="../xbd/glossary.html"><b>Glossary</b> </a> ).With no options and only if the user has appropriate privileges,the executed utility is run with a system scheduling prioritythat is some implementation-dependent quantity less thanor equal to the system scheduling priority of the current process.If the userlacks appropriate privileges to affect the system schedulingpriority in the requested manner, the<i>nice</i>utility will not affect thesystem scheduling priority;in this case, a warning message may be written to standard error,but this will not prevent the invocation of<i>utility</i>or affect the exit status.</blockquote><h4><a name = "tag_001_014_1520"> </a>OPTIONS</h4><blockquote>The<i>nice</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b> </a> except thatthe obsolescent version allows amulti-digit decimal integer as an option name.<p>The following option is supported:<dl compact><dt><b>-n </b><i>increment</i><dd><dt><b>-</b><i>increment</i><dd>Specify how the system scheduling priority of the executedutility will be adjusted.The<i>increment</i>option-argument is a positive or negative decimal integer thatwill be used to modify the system scheduling priority ofthe executed utility in an implementation-dependent manner.Positive<i>increment</i>values cause a lower or unchanged system scheduling priority.Negative<i>increment</i>values may require appropriate privileges andwill cause a higher or unchanged system scheduling priority.The system scheduling priority is boundedin an implementation-dependent manner.If the requested<i>increment</i>would raise or lower the system scheduling priority of the executedutility beyond implementation-dependent limits,then the limit whose value wasexceeded is used.</dl></blockquote><h4><a name = "tag_001_014_1521"> </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_1522"> </a>STDIN</h4><blockquote>Not used.</blockquote><h4><a name = "tag_001_014_1523"> </a>INPUT FILES</h4><blockquote>None.<br></blockquote><h4><a name = "tag_001_014_1524"> </a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>nice</i>:<dl compact><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 pathused 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_1525"> </a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_1526"> </a>STDOUT</h4><blockquote>Not used.</blockquote><h4><a name = "tag_001_014_1527"> </a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_1528"> </a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1529"> </a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1530"> </a>EXIT STATUS</h4><blockquote>If the<i>utility</i>utility is invoked, the exit status of<i>nice</i>will be the exit status of<i>utility;</i>otherwise, the<i>nice</i>utility will exit with one of the following values:<dl compact><dt>1'<dd>An error occurred in the<i>nice</i>utility.<dt>126<dd>The utility specified by<i>utility</i>was found but could not be invoked.<dt>127<dd>The utility specified by<i>utility</i>could not be found.</dl></blockquote><h4><a name = "tag_001_014_1531"> </a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.<br></blockquote><h4><a name = "tag_001_014_1532"> </a>APPLICATION USAGE</h4><blockquote>Note that, in the obsolescent version,<b>-5</b>is a positive<i>increment</i>,while<b>--5</b>is a negative<i>increment</i>.<p>The only guaranteed portable uses of this utility are:<dl compact><dt><i>nice utility</i><dd>Run<i>utility</i>with the default lower system scheduling priority.<dt><i>nice </i><b>-n </b><i><positive integer> utility</i><dd>Run<i>utility</i>with a lower system scheduling priority.</dl><p>On some systems they will have no discernible effecton the invoked utilityand on some others they will be exactly equivalent.<p>Historical systems have frequently supported the<<i>positive integer</i>>up to 20.Since there is no error penalty associatedwith guessing a number that is too high,users without access to the system conformancedocument (to see what limits are actually in place)could use the historical 1 to 20 range or attemptto use very large numbers if the job should betruly low priority.<p>The system scheduling priorityvalue of a process can be displayed using the command:<pre><code>ps -o nice</code></pre><p>The<i><a href="command.html">command</a></i>,<i><a href="env.html">env</a></i>,<i>nice</i>,<i><a href="nohup.html">nohup</a></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.</blockquote><h4><a name = "tag_001_014_1533"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1534"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1535"> </a>SEE ALSO</h4><blockquote><i><a href="renice.html">renice</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 + -