.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved .TH "BATCH" 1P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" .\" batch .SH NAME batch \- schedule commands to be executed in a batch queue .SH SYNOPSIS .LP \fB\fP \fIbatch\fP\fB\fP .SH DESCRIPTION .LP The \fIbatch\fP utility shall read commands from standard input and schedule them for execution in a batch queue. It shall be the equivalent of the command: .sp .RS .nf \fBat -q b -m now \fP .fi .RE .LP where queue \fIb\fP is a special \fIat\fP 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 \fIbatch\fP. .LP Users shall be permitted to use \fIbatch\fP if their name appears in the file \fB/usr/lib/cron/at.allow\fP. If that file does not exist, the file \fB/usr/lib/cron/at.deny\fP shall be checked to determine whether the user shall be denied access to \fIbatch\fP. If neither file exists, only a process with the appropriate privileges shall be allowed to submit a job. If only \fBat.deny\fP exists and is empty, global usage shall be permitted. The \fBat.allow\fP and \fBat.deny\fP files shall consist of one user name per line. .SH OPTIONS .LP None. .SH OPERANDS .LP None. .SH STDIN .LP The standard input shall be a text file consisting of commands acceptable to the shell command language described in \fIShell Command Language\fP \&. .SH INPUT FILES .LP The text files \fB/usr/lib/cron/at.allow\fP and \fB/usr/lib/cron/at.deny\fP shall contain zero or more user names, one per line, of users who are, respectively, authorized or denied access to the \fIat\fP and \fIbatch\fP utilities. .SH ENVIRONMENT VARIABLES .LP The following environment variables shall affect the execution of \fIbatch\fP: .TP 7 \fILANG\fP Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) .TP 7 \fILC_ALL\fP If set to a non-empty string value, override the values of all the other internationalization variables. .TP 7 \fILC_CTYPE\fP 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). .TP 7 \fILC_MESSAGES\fP 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. .TP 7 \fILC_TIME\fP Determine the format and contents for date and time strings written by \fIbatch\fP. .TP 7 \fINLSPATH\fP Determine the location of message catalogs for the processing of \fILC_MESSAGES \&.\fP .TP 7 \fISHELL\fP Determine the name of a command interpreter to be used to invoke the at-job. If the variable is unset or null, \fIsh\fP shall be used. If it is set to a value other than a name for \fIsh\fP, the implementation shall do one of the following: use that shell; use \fIsh\fP; use the login shell from the user database; any of the preceding accompanied by a warning diagnostic about which was chosen. .TP 7 \fITZ\fP Determine the timezone. The job shall be submitted for execution at the time specified by \fItimespec\fP or \fB-t\fP \fItime\fP relative to the timezone specified by the \fITZ\fP variable. If \fItimespec\fP specifies a timezone, it overrides \fITZ .\fP If \fItimespec\fP does not specify a timezone and \fITZ\fP is unset or null, an unspecified default timezone shall be used. .sp .SH ASYNCHRONOUS EVENTS .LP Default. .SH STDOUT .LP 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. .SH STDERR .LP The following shall be written to standard error when a job has been successfully submitted: .sp .RS .nf \fB"job %s at %s\\n",\fP \fIat_job_id\fP\fB, <\fP\fIdate\fP\fB> \fP .fi .RE .LP where \fIdate\fP shall be equivalent in format to the output of: .sp .RS .nf \fBdate +"%a %b %e %T %Y" \fP .fi .RE .LP The date and time written shall be adjusted so that they appear in the timezone of the user (as determined by the \fITZ\fP variable). .LP Neither this, nor warning messages concerning the selection of the command interpreter, are considered a diagnostic that changes the exit status. .LP Diagnostic messages, if any, shall be written to standard error. .SH OUTPUT FILES .LP None. .SH EXTENDED DESCRIPTION .LP None. .SH EXIT STATUS .LP The following exit values shall be returned: .TP 7 \ 0 Successful completion. .TP 7 >0 An error occurred. .sp .SH CONSEQUENCES OF ERRORS .LP The job shall not be scheduled. .LP \fIThe following sections are informative.\fP .SH APPLICATION USAGE .LP It may be useful to redirect standard output within the specified commands. .SH EXAMPLES .IP " 1." 4 This sequence can be used at a terminal: .sp .RS .nf \fBbatch sort < file >outfile EOT \fP .fi .RE .LP .IP " 2." 4 This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output redirection specifications is significant): .sp .RS .nf \fBbatch << ! diff file1 file2 2>&1 >outfile | mailx mygroup ! \fP .fi .RE .LP .SH RATIONALE .LP Early proposals described \fIbatch\fP in a manner totally separated from \fIat\fP, even though the historical model treated it almost as a synonym for \fIat\fP \fB-qb\fP. A number of features were added to list and control batch work separately from those in \fIat\fP. Upon further reflection, it was decided that the benefit of this did not merit the change to the historical interface. .LP The \fB-m\fP option was included on the equivalent \fIat\fP 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 \fIat\fP, the \fBnow\fP keyword submits the job for immediate execution (after scheduling delays), despite some historical systems where \fIat\fP \fBnow\fP would have been considered an error. .SH FUTURE DIRECTIONS .LP None. .SH SEE ALSO .LP \fIat\fP .SH COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .