AT(1)                      POSIX Programmer's Manual                     AT(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
       at -- execute commands at a later time

SSYYNNOOPPSSIISS
       at [[-m]] [[-f _f_i_l_e]] [[-q _q_u_e_u_e_n_a_m_e]] -t _t_i_m_e___a_r_g

       at [[-m]] [[-f _f_i_l_e]] [[-q _q_u_e_u_e_n_a_m_e]] _t_i_m_e_s_p_e_c...

       at -r _a_t___j_o_b___i_d...

       at -l -q _q_u_e_u_e_n_a_m_e

       at -l [[_a_t___j_o_b___i_d...]]

DDEESSCCRRIIPPTTIIOONN
       The _a_t utility shall read commands from standard input and group them
       together as an _a_t_-_j_o_b, to be executed at a later time.

       The at-job shall be executed in a separate invocation of the shell,
       running in a separate process group with no controlling terminal,
       except that the environment variables, current working directory, file
       creation mask, and other implementation-defined execution-time
       attributes in effect when the _a_t utility is executed shall be retained
       and used when the at-job is executed.

       When the at-job is submitted, the _a_t___j_o_b___i_d and scheduled time shall be
       written to standard error. The _a_t___j_o_b___i_d is an identifier that shall be
       a string consisting solely of alphanumeric characters and the <period>
       character. The _a_t___j_o_b___i_d shall be assigned by the system when the job
       is scheduled such that it uniquely identifies a particular job.

       User notification and the processing of the job's standard output and
       standard error are described under the --mm option.

       Users shall be permitted to use _a_t 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 _a_t.  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
       The _a_t utility shall conform to the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s.

       The following options shall be supported:

       --ff _f_i_l_e   Specify the pathname of a file to be used as the source of
                 the at-job, instead of standard input.

       --ll        (The letter ell.) Report all jobs scheduled for the invoking
                 user if no _a_t___j_o_b___i_d operands are specified. If _a_t___j_o_b___i_ds
                 are specified, report only information for these jobs. The
                 output shall be written to standard output.

       --mm        Send mail to the invoking user after the at-job has run,
                 announcing its completion. Standard output and standard error
                 produced by the at-job shall be mailed to the user as well,
                 unless redirected elsewhere. Mail shall be sent even if the
                 job produces no output.

                 If --mm is not used, the job's standard output and standard
                 error shall be provided to the user by means of mail, unless
                 they are redirected elsewhere; if there is no such output to
                 provide, the implementation need not notify the user of the
                 job's completion.

       --qq _q_u_e_u_e_n_a_m_e
                 Specify in which queue to schedule a job for submission. When
                 used with the --ll option, limit the search to that particular
                 queue. By default, at-jobs shall be scheduled in queue _a.  In
                 contrast, queue _b shall be reserved for batch jobs; see
                 _b_a_t_c_h.  The meanings of all other _q_u_e_u_e_n_a_m_es are
                 implementation-defined. If --qq is specified along with either
                 of the --tt _t_i_m_e___a_r_g or _t_i_m_e_s_p_e_c arguments, the results are
                 unspecified.

       --rr        Remove the jobs with the specified _a_t___j_o_b___i_d operands that
                 were previously scheduled by the _a_t utility.

       --tt _t_i_m_e___a_r_g
                 Submit the job to be run at the time specified by the _t_i_m_e
                 option-argument, which the application shall ensure has the
                 format as specified by the _t_o_u_c_h --tt _t_i_m_e utility.

OOPPEERRAANNDDSS
       The following operands shall be supported:

       _a_t___j_o_b___i_d The name reported by a previous invocation of the _a_t utility
                 at the time the job was scheduled.

       _t_i_m_e_s_p_e_c  Submit the job to be run at the date and time specified. All
                 of the _t_i_m_e_s_p_e_c operands are interpreted as if they were
                 separated by <space> characters and concatenated, and shall
                 be parsed as described in the grammar at the end of this
                 section. The date and time shall be interpreted as being in
                 the timezone of the user (as determined by the _T_Z variable),
                 unless a timezone name appears as part of _t_i_m_e, below.

                 In the POSIX locale, the following describes the three parts
                 of the time specification string. All of the values from the
                 _L_C___T_I_M_E categories in the POSIX locale shall be recognized in
                 a case-insensitive manner.

                 _t_i_m_e      The time can be specified as one, two, or four
                           digits. One-digit and two-digit numbers shall be
                           taken to be hours; four-digit numbers to be hours
                           and minutes. The time can alternatively be
                           specified as two numbers separated by a <colon>,
                           meaning _h_o_u_r:_m_i_n_u_t_e. An AM/PM indication (one of
                           the values from the aamm__ppmm keywords in the _L_C___T_I_M_E
                           locale category) can follow the time; otherwise, a
                           24-hour clock time shall be understood. A timezone
                           name can also follow to further qualify the time.
                           The acceptable timezone names are implementation-
                           defined, except that they shall be case-insensitive
                           and the string uuttcc is supported to indicate the
                           time is in Coordinated Universal Time.  In the
                           POSIX locale, the _t_i_m_e field can also be one of the
                           following tokens:

                           mmiiddnniigghhtt  Indicates the time 12:00 am (00:00).

                           nnoooonn      Indicates the time 12:00 pm.

                           nnooww       Indicates the current day and time.
                                     Invoking _a_t <nnooww> shall submit an at-job
                                     for potentially immediate execution (that
                                     is, subject only to unspecified
                                     scheduling delays).

                 _d_a_t_e      An optional _d_a_t_e can be specified as either a month
                           name (one of the values from the mmoonn or aabbmmoonn
                           keywords in the _L_C___T_I_M_E locale category) followed
                           by a day number (and possibly year number preceded
                           by a comma), or a day of the week (one of the
                           values from the ddaayy or aabbddaayy keywords in the
                           _L_C___T_I_M_E locale category). In the POSIX locale, two
                           special days shall be recognized:

                           ttooddaayy     Indicates the current day.

                           ttoommoorrrrooww  Indicates the day following the current
                                     day.

                           If no _d_a_t_e is given, ttooddaayy shall be assumed if the
                           given time is greater than the current time, and
                           ttoommoorrrrooww shall be assumed if it is less. If the
                           given month is less than the current month (and no
                           year is given), next year shall be assumed.

                 _i_n_c_r_e_m_e_n_t The optional _i_n_c_r_e_m_e_n_t shall be a number preceded
                           by a <plus-sign> (''++'') and suffixed by one of the
                           following: mmiinnuutteess, hhoouurrss, ddaayyss, wweeeekkss, mmoonntthhss, or
                           yyeeaarrss.  (The singular forms shall also be
                           accepted.) The keyword nneexxtt shall be equivalent to
                           an increment number of +1. For example, the
                           following are equivalent commands:


                               at 2pm + 1 week
                               at 2pm next week

       The following grammar describes the precise format of _t_i_m_e_s_p_e_c in the
       POSIX locale. The general conventions for this style of grammar are
       described in _S_e_c_t_i_o_n _1_._3, _G_r_a_m_m_a_r _C_o_n_v_e_n_t_i_o_n_s.  This formal syntax
       shall take precedence over the preceding text syntax description. The
       longest possible token or delimiter shall be recognized at a given
       point. When used in a _t_i_m_e_s_p_e_c, white space shall also delimit tokens.


           %token hr24clock_hr_min
           %token hr24clock_hour
           /*
             An hr24clock_hr_min is a one, two, or four-digit number. A one-digit
             or two-digit number constitutes an hr24clock_hour. An hr24clock_hour
             may be any of the single digits [0,9], or may be double digits, ranging
             from [00,23]. If an hr24clock_hr_min is a four-digit number, the
             first two digits shall be a valid hr24clock_hour, while the last two
             represent the number of minutes, from [00,59].
           */

           %token wallclock_hr_min
           %token wallclock_hour
           /*
             A wallclock_hr_min is a one, two-digit, or four-digit number.
             A one-digit or two-digit number constitutes a wallclock_hour.
             A wallclock_hour may be any of the single digits [1,9], or may
             be double digits, ranging from [01,12]. If a wallclock_hr_min
             is a four-digit number, the first two digits shall be a valid
             wallclock_hour, while the last two represent the number of
             minutes, from [00,59].
           */

           %token minute
           /*
             A minute is a one or two-digit number whose value can be [0,9]
             or [00,59].
           */

           %token day_number
           /*
             A day_number is a number in the range appropriate for the particular
             month and year specified by month_name and year_number, respectively.
             If no year_number is given, the current year is assumed if the given
             date and time are later this year. If no year_number is given and
             the date and time have already occurred this year and the month is
             not the current month, next year is the assumed year.
           */

           %token year_number
           /*
             A year_number is a four-digit number representing the year A.D., in
             which the at_job is to be run.
           */

           %token inc_number
           /*
             The inc_number is the number of times the succeeding increment
             period is to be added to the specified date and time.
           */

           %token timezone_name
           /*
             The name of an optional timezone suffix to the time field, in an
             implementation-defined format.
           */

           %token month_name
           /*
             One of the values from the mon or abmon keywords in the LC_TIME
             locale category.
           */

           %token day_of_week
           /*
             One of the values from the day or abday keywords in the LC_TIME
             locale category.
           */

           %token am_pm
           /*
             One of the values from the am_pm keyword in the LC_TIME locale
             category.
           */

           %start timespec
           %%
           timespec    : time
                       | time date
                       | time increment
                       | time date increment
                       | nowspec
                       ;

           nowspec     : "now"
                       | "now" increment
                       ;

           time        : hr24clock_hr_min
                       | hr24clock_hr_min timezone_name
                       | hr24clock_hour ":" minute
                       | hr24clock_hour ":" minute timezone_name
                       | wallclock_hr_min am_pm
                       | wallclock_hr_min am_pm timezone_name
                       | wallclock_hour ":" minute am_pm
                       | wallclock_hour ":" minute am_pm timezone_name
                       | "noon"
                       | "midnight"
                       ;

           date        : month_name day_number
                       | month_name day_number "," year_number
                       | day_of_week
                       | "today"
                       | "tomorrow"
                       ;

           increment   : "+" inc_number inc_period
                       | "next" inc_period
                       ;

           inc_period  : "minute" | "minutes"
                       | "hour" | "hours"
                       | "day" | "days"
                       | "week" | "weeks"
                       | "month" | "months"
                       | "year" | "years"
                       ;

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.  The standard input shall only be used if no --ff _f_i_l_e
       option is specified.

IINNPPUUTT FFIILLEESS
       See the STDIN section.

       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 _a_t:

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

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

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

       _S_H_E_L_L     Determine a 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; or
                 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 shall override _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.

       In the POSIX locale, the following shall be written to the standard
       output for each job when jobs are listed in response to the --ll option:


           "%s\t%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).

SSTTDDEERRRR
       In the POSIX locale, 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 has the same format as that described in the STDOUT section.
       Neither this, nor warning messages concerning the selection of the
       command interpreter, shall be 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    The _a_t utility successfully submitted, removed, or listed a job
             or jobs.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       The job shall not be scheduled, removed, or listed.

       _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
       The format of the _a_t command line shown here is guaranteed only for the
       POSIX locale. Other cultures may be supported with substantially
       different interfaces, although implementations are encouraged to
       provide comparable levels of functionality.

       Since the commands run in a separate shell invocation, running in a
       separate process group with no controlling terminal, open file
       descriptors, traps, and priority inherited from the invoking
       environment are lost.

       Some implementations do not allow substitution of different shells
       using _S_H_E_L_L.  System V systems, for example, have used the login shell
       value for the user in //eettcc//ppaasssswwdd.  To select reliably another command
       interpreter, the user must include it as part of the script, such as:


           $$ at 1800
           myshell myscript
           EOT
           jjoobb ...... aatt ......
           $$

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


               at -m 0730 tomorrow
               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):


               at now + 1 hour <<!
               diff file1 file2 2>&1 >outfile | mailx mygroup
               !

        3. To have a job reschedule itself, _a_t can be invoked from within the
           at-job. For example, this daily processing script named mmyy..ddaaiillyy
           runs every day (although _c_r_o_n_t_a_b is a more appropriate vehicle for
           such work):


               # my.daily runs every day
               _d_a_i_l_y _p_r_o_c_e_s_s_i_n_g
               at now tomorrow < my.daily

        4. The spacing of the three portions of the POSIX locale _t_i_m_e_s_p_e_c is
           quite flexible as long as there are no ambiguities. Examples of
           various times and operand presentation include:


               at 0815am Jan 24
               at 8 :15amjan24
               at now "+ 1day"
               at 5 pm FRIday
               at '17
                   utc+
                   30minutes'

RRAATTIIOONNAALLEE
       The _a_t utility reads from standard input the commands to be executed at
       a later time. It may be useful to redirect standard output and standard
       error within the specified commands.

       The --tt _t_i_m_e option was added as a new capability to support an
       internationalized way of specifying a time for execution of the
       submitted job.

       Early proposals added a ``jobname'' concept as a way of giving
       submitted jobs names that are meaningful to the user submitting them.
       The historical, system-specified _a_t___j_o_b___i_d gives no indication of what
       the job is. Upon further reflection, it was decided that the benefit of
       this was not worth the change in historical interface. The _a_t
       functionality is useful in simple environments, but in large or complex
       situations, the functionality provided by the Batch Services option is
       more suitable.

       The --qq option historically has been an undocumented option, used mainly
       by the _b_a_t_c_h utility.

       The System V --mm option was added to provide a method for informing
       users that an at-job had completed. Otherwise, users are only informed
       when output to standard error or standard output are not redirected.

       The behavior of _a_t <nnooww> was changed in an early proposal from being
       unspecified to submitting a job for potentially immediate execution.
       Historical BSD _a_t implementations support this. Historical System V
       implementations give an error in that case, but a change to the System
       V versions should have no backwards-compatibility ramifications.

       On BSD-based systems, a --uu _u_s_e_r option has allowed those with
       appropriate privileges to access the work of other users. Since this is
       primarily a system administration feature and is not universally
       implemented, it has been omitted. Similarly, a specification for the
       output format for a user with appropriate privileges viewing the queues
       of other users has been omitted.

       The --ff _f_i_l_e option from System V is used instead of the BSD method of
       using the last operand as the pathname. The BSD method is ambiguous--
       does:


           at 1200 friday

       mean the same thing if there is a file named ffrriiddaayy in the current
       directory?

       The _a_t___j_o_b___i_d is composed of a limited character set in historical
       practice, and it is mandated here to invalidate systems that might try
       using characters that require shell quoting or that could not be easily
       parsed by shell scripts.

       The _a_t utility varies between System V and BSD systems in the way
       timezones are used. On System V systems, the _T_Z variable affects the
       at-job submission times and the times displayed for the user. On BSD
       systems, _T_Z is not taken into account. The BSD behavior is easily
       achieved with the current specification. If the user wishes to have the
       timezone default to that of the system, they merely need to issue the
       _a_t command immediately following an unsetting or null assignment to _T_Z.
       For example:


           TZ= at noon ...

       gives the desired BSD result.

       While the _y_a_c_c-like grammar specified in the OPERANDS section is
       lexically unambiguous with respect to the digit strings, a lexical
       analyzer would probably be written to look for and return digit strings
       in those cases. The parser could then check whether the digit string
       returned is a valid _d_a_y___n_u_m_b_e_r, _y_e_a_r___n_u_m_b_e_r, and so on, based on the
       context.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _b_a_t_c_h, _c_r_o_n_t_a_b

       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, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_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                                AT(1)
