Files
oldlinux-files/Ref-docs/POSIX/susv3/utilities/batch.html
2024-02-19 00:21:47 -05:00

307 lines
11 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>batch</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="batch"></a> <a name="tag_04_08"></a><!-- batch -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_04_08_01"></a>NAME</h4>
<blockquote>batch - schedule commands to be executed in a batch queue</blockquote>
<h4><a name="tag_04_08_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<div class="box"><code><tt><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt=
"[Option Start]" border="0"></tt> <i>batch</i><tt><img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
</blockquote>
<h4><a name="tag_04_08_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>batch</i> utility shall read commands from standard input and schedule them for execution in a batch queue. It shall be
the equivalent of the command:</p>
<pre>
<tt>at -q b -m now
</tt>
</pre>
<p>where queue <i>b</i> is a special <a href="../utilities/at.html"><i>at</i></a> queue, specifically for batch jobs. Batch jobs
shall be submitted to the batch queue with no time constraints and shall be run by the system using algorithms, based on
unspecified factors, that may vary with each invocation of <i>batch</i>.</p>
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
Users shall be permitted to use <i>batch</i> if their name appears in the file <b>/usr/lib/cron/at.allow</b>. If that file does not
exist, the file <b>/usr/lib/cron/at.deny</b> shall be checked to determine whether the user shall be denied access to <i>batch</i>.
If neither file exists, only a process with the appropriate privileges shall be allowed to submit a job. If only <b>at.deny</b>
exists and is empty, global usage shall be permitted. The <b>at.allow</b> and <b>at.deny</b> files shall consist of one user name
per line. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
</blockquote>
<h4><a name="tag_04_08_04"></a>OPTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_08_05"></a>OPERANDS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_08_06"></a>STDIN</h4>
<blockquote>
<p>The standard input shall be a text file consisting of commands acceptable to the shell command language described in <a href=
"xcu_chap02.html#tag_02"><i>Shell Command Language</i></a> .</p>
</blockquote>
<h4><a name="tag_04_08_07"></a>INPUT FILES</h4>
<blockquote>
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
The text files <b>/usr/lib/cron/at.allow</b> and <b>/usr/lib/cron/at.deny</b> shall contain zero or more user names, one per line,
of users who are, respectively, authorized or denied access to the <a href="../utilities/at.html"><i>at</i></a> and <i>batch</i>
utilities. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
</blockquote>
<h4><a name="tag_04_08_08"></a>ENVIRONMENT VARIABLES</h4>
<blockquote>
<p>The following environment variables shall affect the execution of <i>batch</i>:</p>
<dl compact>
<dt><i>LANG</i></dt>
<dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of
IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> for
the precedence of internationalization variables used to determine the values of locale categories.)</dd>
<dt><i>LC_ALL</i></dt>
<dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
<dt><i>LC_CTYPE</i></dt>
<dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
opposed to multi-byte characters in arguments and input files).</dd>
<dt><i>LC_MESSAGES</i></dt>
<dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and
informative messages written to standard output.</dd>
<dt><i>LC_TIME</i></dt>
<dd>Determine the format and contents for date and time strings written by <i>batch</i>.</dd>
<dt><i>NLSPATH</i></dt>
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt=
"[Option End]" border="0"></dd>
<dt><i>SHELL</i></dt>
<dd>Determine the name of a command interpreter to be used to invoke the at-job. If the variable is unset or null, <a href=
"../utilities/sh.html"><i>sh</i></a> shall be used. If it is set to a value other than a name for <a href=
"../utilities/sh.html"><i>sh</i></a>, the implementation shall do one of the following: use that shell; use <a href=
"../utilities/sh.html"><i>sh</i></a>; use the login shell from the user database; any of the preceding accompanied by a warning
diagnostic about which was chosen.</dd>
<dt><i>TZ</i></dt>
<dd>Determine the timezone. The job shall be submitted for execution at the time specified by <i>timespec</i> or <b>-t</b>
<i>time</i> relative to the timezone specified by the <i>TZ</i> variable. If <i>timespec</i> specifies a timezone, it overrides
<i>TZ .</i> If <i>timespec</i> does not specify a timezone and <i>TZ</i> is unset or null, an unspecified default timezone shall be
used.</dd>
</dl>
</blockquote>
<h4><a name="tag_04_08_09"></a>ASYNCHRONOUS EVENTS</h4>
<blockquote>
<p>Default.</p>
</blockquote>
<h4><a name="tag_04_08_10"></a>STDOUT</h4>
<blockquote>
<p>When standard input is a terminal, prompts of unspecified format for each line of the user input described in the STDIN section
may be written to standard output.</p>
</blockquote>
<h4><a name="tag_04_08_11"></a>STDERR</h4>
<blockquote>
<p>The following shall be written to standard error when a job has been successfully submitted:</p>
<pre>
<tt>"job %s at %s\n",</tt> <i>at_job_id</i><tt>, &lt;</tt><i>date</i><tt>&gt;
</tt>
</pre>
<p>where <i>date</i> shall be equivalent in format to the output of:</p>
<pre>
<tt>date +"%a %b %e %T %Y"
</tt>
</pre>
<p>The date and time written shall be adjusted so that they appear in the timezone of the user (as determined by the <i>TZ</i>
variable).</p>
<p>Neither this, nor warning messages concerning the selection of the command interpreter, are considered a diagnostic that changes
the exit status.</p>
<p>Diagnostic messages, if any, shall be written to standard error.</p>
</blockquote>
<h4><a name="tag_04_08_12"></a>OUTPUT FILES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_08_13"></a>EXTENDED DESCRIPTION</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_08_14"></a>EXIT STATUS</h4>
<blockquote>
<p>The following exit values shall be returned:</p>
<dl compact>
<dt>&nbsp;0</dt>
<dd>Successful completion.</dd>
<dt>&gt;0</dt>
<dd>An error occurred.</dd>
</dl>
</blockquote>
<h4><a name="tag_04_08_15"></a>CONSEQUENCES OF ERRORS</h4>
<blockquote>
<p>The job shall not be scheduled.</p>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_04_08_16"></a>APPLICATION USAGE</h4>
<blockquote>
<p>It may be useful to redirect standard output within the specified commands.</p>
</blockquote>
<h4><a name="tag_04_08_17"></a>EXAMPLES</h4>
<blockquote>
<ol>
<li>
<p>This sequence can be used at a terminal:</p>
<pre>
<tt>batch
sort &lt; file &gt;outfile
EOT
</tt>
</pre>
</li>
<li>
<p>This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output
redirection specifications is significant):</p>
<pre>
<tt>batch &lt;&lt;
! diff file1 file2 2&gt;&amp;1 &gt;outfile | mailx mygroup
!
</tt>
</pre>
</li>
</ol>
</blockquote>
<h4><a name="tag_04_08_18"></a>RATIONALE</h4>
<blockquote>
<p>Early proposals described <i>batch</i> in a manner totally separated from <a href="../utilities/at.html"><i>at</i></a>, even
though the historical model treated it almost as a synonym for <a href="../utilities/at.html"><i>at</i></a> <b>-qb</b>. A number of
features were added to list and control batch work separately from those in <a href="../utilities/at.html"><i>at</i></a>. Upon
further reflection, it was decided that the benefit of this did not merit the change to the historical interface.</p>
<p>The <b>-m</b> option was included on the equivalent <a href="../utilities/at.html"><i>at</i></a> command because it is
historical practice to mail results to the submitter, even if all job-produced output is redirected. As explained in the RATIONALE
for <a href="../utilities/at.html"><i>at</i></a>, the <b>now</b> keyword submits the job for immediate execution (after scheduling
delays), despite some historical systems where <a href="../utilities/at.html"><i>at</i></a> <b>now</b> would have been considered
an error.</p>
</blockquote>
<h4><a name="tag_04_08_19"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_08_20"></a>SEE ALSO</h4>
<blockquote>
<p><a href="at.html"><i>at</i></a></p>
</blockquote>
<h4><a name="tag_04_08_21"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 2.</p>
</blockquote>
<h4><a name="tag_04_08_22"></a>Issue 6</h4>
<blockquote>
<p>This utility is marked as part of the User Portability Utilities option.</p>
<p>The NAME is changed to align with the IEEE&nbsp;P1003.2b draft standard.</p>
<p>The normative text is reworded to avoid use of the term &quot;must&quot; for application requirements.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>