BATCH(1)                   POSIX Programmer's Manual                  BATCH(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       batch -- schedule commands to be executed in a batch queue

SSYYNNOOPPSSIISS
       _b_a_t_c_h

DDEESSCCRRIIPPTTIIOONN
       The _b_a_t_c_h utility shall read commands from standard input and schedule
       them for execution in a batch queue. It shall be the equivalent of the
       command:


           at -q b -m now

       where queue _b is a special _a_t 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 _b_a_t_c_h.

       Users shall be permitted to use _b_a_t_c_h if their name appears in the file
       aatt..aallllooww which is located in an implementation-defined directory.  If
       that file does not exist, the file aatt..ddeennyy, which is located in an
       implementation-defined directory, shall be checked to determine whether
       the user shall be denied access to _b_a_t_c_h.  If neither file exists, only
       a process with appropriate privileges shall be allowed to submit a job.
       If only aatt..ddeennyy exists and is empty, global usage shall be permitted.
       The aatt..aallllooww and aatt..ddeennyy files shall consist of one user name per line.

OOPPTTIIOONNSS
       None.

OOPPEERRAANNDDSS
       None.

SSTTDDIINN
       The standard input shall be a text file consisting of commands
       acceptable to the shell command language described in _C_h_a_p_t_e_r _2, _S_h_e_l_l
       _C_o_m_m_a_n_d _L_a_n_g_u_a_g_e.

IINNPPUUTT FFIILLEESS
       The text files aatt..aallllooww and aatt..ddeennyy, which are located in an
       implementation-defined directory, shall contain zero or more user
       names, one per line, of users who are, respectively, authorized or
       denied access to the _a_t and _b_a_t_c_h utilities.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of
       _b_a_t_c_h:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_T_Y_P_E  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).

       _L_C___M_E_S_S_A_G_E_S
                 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.

       _L_C___T_I_M_E   Determine the format and contents for date and time strings
                 written by _b_a_t_c_h.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

       _S_H_E_L_L     Determine the name of a command interpreter to be used to
                 invoke the at-job. If the variable is unset or null, _s_h shall
                 be used. If it is set to a value other than a name for _s_h,
                 the implementation shall do one of the following: use that
                 shell; use _s_h; use the login shell from the user database;
                 any of the preceding accompanied by a warning diagnostic
                 about which was chosen.

       _T_Z        Determine the timezone. The job shall be submitted for
                 execution at the time specified by _t_i_m_e_s_p_e_c or --tt _t_i_m_e
                 relative to the timezone specified by the _T_Z variable. If
                 _t_i_m_e_s_p_e_c specifies a timezone, it overrides _T_Z.  If _t_i_m_e_s_p_e_c
                 does not specify a timezone and _T_Z is unset or null, an
                 unspecified default timezone shall be used.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       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.

SSTTDDEERRRR
       The following shall be written to standard error when a job has been
       successfully submitted:


           "job %s at %s\n", _a_t___j_o_b___i_d, <_d_a_t_e>

       where _d_a_t_e shall be equivalent in format to the output of:


           date +"%a %b %e %T %Y"

       The date and time written shall be adjusted so that they appear in the
       timezone of the user (as determined by the _T_Z variable).

       Neither this, nor warning messages concerning the selection of the
       command interpreter, are considered a diagnostic that changes the exit
       status.

       Diagnostic messages, if any, shall be written to standard error.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    Successful completion.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       The job shall not be scheduled.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       It may be useful to redirect standard output within the specified
       commands.

EEXXAAMMPPLLEESS
        1. This sequence can be used at a terminal:


               batch
               sort < file >outfile
               EOT

        2. This sequence, which demonstrates redirecting standard error to a
           pipe, is useful in a command procedure (the sequence of output
           redirection specifications is significant):


               batch <<!
               diff file1 file2 2>&1 >outfile | mailx mygroup
               !

RRAATTIIOONNAALLEE
       Early proposals described _b_a_t_c_h in a manner totally separated from _a_t,
       even though the historical model treated it almost as a synonym for _a_t
       --qqbb.  A number of features were added to list and control batch work
       separately from those in _a_t.  Upon further reflection, it was decided
       that the benefit of this did not merit the change to the historical
       interface.

       The --mm option was included on the equivalent _a_t 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_t,
       the nnooww keyword submits the job for immediate execution (after
       scheduling delays), despite some historical systems where _a_t nnooww would
       have been considered an error.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _a_t

       The Base Definitions volume of POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 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 .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                             BATCH(1)
