1AT(1P)                     POSIX Programmer's Manual                    AT(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       at — execute commands at a later time
14

SYNOPSIS

16       at [−m] [−f file] [−q queuename] −t time_arg
17
18       at [−m] [−f file] [−q queuename] timespec...
19
20       at −r at_job_id...
21
22       at −l −q queuename
23
24       at −l [at_job_id...]
25

DESCRIPTION

27       The at utility shall read commands from standard input and  group  them
28       together as an at-job, to be executed at a later time.
29
30       The  at-job  shall  be  executed in a separate invocation of the shell,
31       running in a separate  process  group  with  no  controlling  terminal,
32       except  that the environment variables, current working directory, file
33       creation  mask,   and   other   implementation-defined   execution-time
34       attributes  in effect when the at utility is executed shall be retained
35       and used when the at-job is executed.
36
37       When the at-job is submitted, the at_job_id and scheduled time shall be
38       written to standard error. The at_job_id is an identifier that shall be
39       a string consisting solely of alphanumeric characters and the  <period>
40       character.  The  at_job_id shall be assigned by the system when the job
41       is scheduled such that it uniquely identifies a particular job.
42
43       User notification and the processing of the job's standard  output  and
44       standard error are described under the −m option.
45
46       Users  shall  be  permitted to use at if their name appears in the file
47       at.allow which is located in an implementation-defined  directory.   If
48       that  file  does  not  exist,  the file at.deny, which is located in an
49       implementation-defined directory, shall be checked to determine whether
50       the  user shall be denied access to at.  If neither file exists, only a
51       process with appropriate privileges shall be allowed to submit  a  job.
52       If  only  at.deny exists and is empty, global usage shall be permitted.
53       The at.allow and at.deny files shall consist of one user name per line.
54

OPTIONS

56       The at  utility  shall  conform  to  the  Base  Definitions  volume  of
57       POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
58
59       The following options shall be supported:
60
61       −f file   Specify  the  pathname  of a file to be used as the source of
62                 the at-job, instead of standard input.
63
64       −l        (The letter ell.) Report all jobs scheduled for the  invoking
65                 user  if  no  at_job_id operands are specified. If at_job_ids
66                 are specified, report only information for  these  jobs.  The
67                 output shall be written to standard output.
68
69       −m        Send  mail  to  the  invoking  user after the at-job has run,
70                 announcing its completion. Standard output and standard error
71                 produced  by  the at-job shall be mailed to the user as well,
72                 unless redirected elsewhere. Mail shall be sent even  if  the
73                 job produces no output.
74
75                 If  −m  is  not  used, the job's standard output and standard
76                 error shall be provided to the user by means of mail,  unless
77                 they  are redirected elsewhere; if there is no such output to
78                 provide, the implementation need not notify the user  of  the
79                 job's completion.
80
81       −q queuename
82                 Specify in which queue to schedule a job for submission. When
83                 used with the −l option, limit the search to that  particular
84                 queue. By default, at-jobs shall be scheduled in queue a.  In
85                 contrast, queue b shall  be  reserved  for  batch  jobs;  see
86                 batch.   The meanings of all other queuenames are implementa‐
87                 tion-defined. If −q is specified along with either of the  −t
88                 time_arg or timespec arguments, the results are unspecified.
89
90       −r        Remove  the  jobs  with the specified at_job_id operands that
91                 were previously scheduled by the at utility.
92
93       −t time_arg
94                 Submit the job to be run at the time specified  by  the  time
95                 option-argument,  which  the application shall ensure has the
96                 format as specified by the touch −t time utility.
97

OPERANDS

99       The following operands shall be supported:
100
101       at_job_id The name reported by a previous invocation of the at  utility
102                 at the time the job was scheduled.
103
104       timespec  Submit  the job to be run at the date and time specified. All
105                 of the timespec operands are interpreted as if they were sep‐
106                 arated  by  <space> characters and concatenated, and shall be
107                 parsed as described in the grammar at the end  of  this  sec‐
108                 tion.  The date and time shall be interpreted as being in the
109                 timezone of the user (as  determined  by  the  TZ  variable),
110                 unless a timezone name appears as part of time, below.
111
112                 In  the POSIX locale, the following describes the three parts
113                 of the time specification string. All of the values from  the
114                 LC_TIME categories in the POSIX locale shall be recognized in
115                 a case-insensitive manner.
116
117                 time      The time can be specified as one, two, or four dig‐
118                           its. One-digit and two-digit numbers shall be taken
119                           to be hours; four-digit numbers  to  be  hours  and
120                           minutes. The time can alternatively be specified as
121                           two  numbers  separated  by  a   <colon>,   meaning
122                           hour:minute. An AM/PM indication (one of the values
123                           from the am_pm keywords in the LC_TIME locale cate‐
124                           gory)  can  follow  the  time; otherwise, a 24-hour
125                           clock time shall be understood. A timezone name can
126                           also  follow  to  further  qualify  the  time.  The
127                           acceptable  timezone  names   are   implementation-
128                           defined, except that they shall be case-insensitive
129                           and the string utc is  supported  to  indicate  the
130                           time  is  in  Coordinated  Universal  Time.  In the
131                           POSIX locale, the time field can also be one of the
132                           following tokens:
133
134                           midnight  Indicates the time 12:00 am (00:00).
135
136                           noon      Indicates the time 12:00 pm.
137
138                           now       Indicates   the  current  day  and  time.
139                                     Invoking at <now> shall submit an  at-job
140                                     for potentially immediate execution (that
141                                     is, subject only to unspecified  schedul‐
142                                     ing delays).
143
144                 date      An optional date can be specified as either a month
145                           name (one of the values from the mon or abmon  key‐
146                           words in the LC_TIME locale category) followed by a
147                           day number (and possibly year number preceded by  a
148                           comma),  or  a  day  of the week (one of the values
149                           from the day  or  abday  keywords  in  the  LC_TIME
150                           locale  category). In the POSIX locale, two special
151                           days shall be recognized:
152
153                           today     Indicates the current day.
154
155                           tomorrow  Indicates the day following  the  current
156                                     day.
157
158                           If  no date is given, today shall be assumed if the
159                           given time is greater than the  current  time,  and
160                           tomorrow  shall  be  assumed  if it is less. If the
161                           given month is less than the current month (and  no
162                           year is given), next year shall be assumed.
163
164                 increment The  optional  increment shall be a number preceded
165                           by a <plus-sign> ('+') and suffixed by one  of  the
166                           following:  minutes, hours, days, weeks, months, or
167                           years.   (The  singular   forms   shall   also   be
168                           accepted.)  The keyword next shall be equivalent to
169                           an increment number of +1. For example, the follow‐
170                           ing are equivalent commands:
171
172                               at 2pm + 1 week
173                               at 2pm next week
174
175       The  following  grammar describes the precise format of timespec in the
176       POSIX locale. The general conventions for this  style  of  grammar  are
177       described  in  Section  1.3,  Grammar  Conventions.  This formal syntax
178       shall take precedence over the preceding text syntax  description.  The
179       longest  possible  token  or  delimiter  shall be recognized at a given
180       point. When used in a timespec, white space shall also delimit tokens.
181
182           %token hr24clock_hr_min
183           %token hr24clock_hour
184           /*
185             An hr24clock_hr_min is a one, two, or four-digit number. A one-digit
186             or two-digit number constitutes an hr24clock_hour. An hr24clock_hour
187             may be any of the single digits [0,9], or may be double digits, ranging
188             from [00,23]. If an hr24clock_hr_min is a four-digit number, the
189             first two digits shall be a valid hr24clock_hour, while the last two
190             represent the number of minutes, from [00,59].
191           */
192
193           %token wallclock_hr_min
194           %token wallclock_hour
195           /*
196             A wallclock_hr_min is a one, two-digit, or four-digit number.
197             A one-digit or two-digit number constitutes a wallclock_hour.
198             A wallclock_hour may be any of the single digits [1,9], or may
199             be double digits, ranging from [01,12]. If a wallclock_hr_min
200             is a four-digit number, the first two digits shall be a valid
201             wallclock_hour, while the last two represent the number of
202             minutes, from [00,59].
203           */
204
205           %token minute
206           /*
207             A minute is a one or two-digit number whose value can be [0,9]
208             or [00,59].
209           */
210
211           %token day_number
212           /*
213             A day_number is a number in the range appropriate for the particular
214             month and year specified by month_name and year_number, respectively.
215             If no year_number is given, the current year is assumed if the given
216             date and time are later this year. If no year_number is given and
217             the date and time have already occurred this year and the month is
218             not the current month, next year is the assumed year.
219           */
220
221           %token year_number
222           /*
223             A year_number is a four-digit number representing the year A.D., in
224             which the at_job is to be run.
225           */
226
227           %token inc_number
228           /*
229             The inc_number is the number of times the succeeding increment
230             period is to be added to the specified date and time.
231           */
232
233           %token timezone_name
234           /*
235             The name of an optional timezone suffix to the time field, in an
236             implementation-defined format.
237           */
238
239           %token month_name
240           /*
241             One of the values from the mon or abmon keywords in the LC_TIME
242             locale category.
243           */
244
245           %token day_of_week
246           /*
247             One of the values from the day or abday keywords in the LC_TIME
248             locale category.
249           */
250
251           %token am_pm
252           /*
253             One of the values from the am_pm keyword in the LC_TIME locale
254             category.
255           */
256
257           %start timespec
258           %%
259           timespec    : time
260                       | time date
261                       | time increment
262                       | time date increment
263                       | nowspec
264                       ;
265
266           nowspec     : "now"
267                       | "now" increment
268                       ;
269
270           time        : hr24clock_hr_min
271                       | hr24clock_hr_min timezone_name
272                       | hr24clock_hour ":" minute
273                       | hr24clock_hour ":" minute timezone_name
274                       | wallclock_hr_min am_pm
275                       | wallclock_hr_min am_pm timezone_name
276                       | wallclock_hour ":" minute am_pm
277                       | wallclock_hour ":" minute am_pm timezone_name
278                       | "noon"
279                       | "midnight"
280                       ;
281
282           date        : month_name day_number
283                       | month_name day_number "," year_number
284                       | day_of_week
285                       | "today"
286                       | "tomorrow"
287                       ;
288
289           increment   : "+" inc_number inc_period
290                       | "next" inc_period
291                       ;
292
293           inc_period  : "minute" | "minutes"
294                       | "hour" | "hours"
295                       | "day" | "days"
296                       | "week" | "weeks"
297                       | "month" | "months"
298                       | "year" | "years"
299                       ;
300

STDIN

302       The standard input shall be a text file consisting of commands  accept‐
303       able  to  the shell command language described in Chapter 2, Shell Com‐
304       mand Language.  The standard input shall only be used  if  no  −f  file
305       option is specified.
306

INPUT FILES

308       See the STDIN section.
309
310       The  text files at.allow and at.deny, which are located in an implemen‐
311       tation-defined directory, shall contain zero or more  user  names,  one
312       per  line,  of users who are, respectively, authorized or denied access
313       to the at and batch utilities.
314

ENVIRONMENT VARIABLES

316       The following environment variables shall affect the execution of at:
317
318       LANG      Provide a default value for  the  internationalization  vari‐
319                 ables  that are unset or null. (See the Base Definitions vol‐
320                 ume of POSIX.1‐2008, Section 8.2, Internationalization  Vari‐
321                 ables  for  the  precedence of internationalization variables
322                 used to determine the values of locale categories.)
323
324       LC_ALL    If set to a non-empty string value, override  the  values  of
325                 all the other internationalization variables.
326
327       LC_CTYPE  Determine  the  locale for the interpretation of sequences of
328                 bytes of text data as characters (for example, single-byte as
329                 opposed  to  multi-byte  characters  in  arguments  and input
330                 files).
331
332       LC_MESSAGES
333                 Determine the locale that should be used to affect the format
334                 and contents of diagnostic messages written to standard error
335                 and informative messages written to standard output.
336
337       NLSPATH   Determine the location of message catalogs for the processing
338                 of LC_MESSAGES.
339
340       LC_TIME   Determine  the  format and contents for date and time strings
341                 written and accepted by at.
342
343       SHELL     Determine a name of a  command  interpreter  to  be  used  to
344                 invoke the at-job. If the variable is unset or null, sh shall
345                 be used. If it is set to a value other than a  name  for  sh,
346                 the  implementation  shall  do one of the following: use that
347                 shell; use sh; use the login shell from the user database; or
348                 any  of  the  preceding  accompanied  by a warning diagnostic
349                 about which was chosen.
350
351       TZ        Determine the timezone. The job shall be submitted for execu‐
352                 tion at the time specified by timespec or −t time relative to
353                 the timezone specified by the TZ variable. If timespec speci‐
354                 fies  a timezone, it shall override TZ.  If timespec does not
355                 specify a timezone and TZ is unset or  null,  an  unspecified
356                 default timezone shall be used.
357

ASYNCHRONOUS EVENTS

359       Default.
360

STDOUT

362       When  standard  input  is a terminal, prompts of unspecified format for
363       each line of the user input described in the STDIN section may be writ‐
364       ten to standard output.
365
366       In  the  POSIX  locale,  the following shall be written to the standard
367       output for each job when jobs are listed in response to the −l option:
368
369           "%s\t%s\n", at_job_id, <date>
370
371       where date shall be equivalent in format to the output of:
372
373           date +"%a %b %e %T %Y"
374
375       The date and time written shall be adjusted so that they appear in  the
376       timezone of the user (as determined by the TZ variable).
377

STDERR

379       In  the  POSIX locale, the following shall be written to standard error
380       when a job has been successfully submitted:
381
382           "job %s at %s\n", at_job_id, <date>
383
384       where date has the same format as that described in the STDOUT section.
385       Neither this, nor warning messages concerning the selection of the com‐
386       mand interpreter, shall be considered a  diagnostic  that  changes  the
387       exit status.
388
389       Diagnostic messages, if any, shall be written to standard error.
390

OUTPUT FILES

392       None.
393

EXTENDED DESCRIPTION

395       None.
396

EXIT STATUS

398       The following exit values shall be returned:
399
400        0    The  at  utility successfully submitted, removed, or listed a job
401             or jobs.
402
403       >0    An error occurred.
404

CONSEQUENCES OF ERRORS

406       The job shall not be scheduled, removed, or listed.
407
408       The following sections are informative.
409

APPLICATION USAGE

411       The format of the at command line shown here is guaranteed only for the
412       POSIX  locale.  Other cultures may be supported with substantially dif‐
413       ferent interfaces, although implementations are encouraged  to  provide
414       comparable levels of functionality.
415
416       Since  the  commands  run  in a separate shell invocation, running in a
417       separate process group with no controlling terminal, open file descrip‐
418       tors,  traps,  and priority inherited from the invoking environment are
419       lost.
420
421       Some implementations do not  allow  substitution  of  different  shells
422       using  SHELL.  System V systems, for example, have used the login shell
423       value for the user in /etc/passwd.  To select reliably another  command
424       interpreter, the user must include it as part of the script, such as:
425
426           $ at 1800
427           myshell myscript
428           EOT
429           job ... at ...
430           $
431

EXAMPLES

433        1. This sequence can be used at a terminal:
434
435               at −m 0730 tomorrow
436               sort < file >outfile
437               EOT
438
439        2. This  sequence,  which demonstrates redirecting standard error to a
440           pipe, is useful in a command procedure (the sequence of output  re‐
441           direction specifications is significant):
442
443               at now + 1 hour <<!
444               diff file1 file2 2>&1 >outfile | mailx mygroup
445               !
446
447        3. To  have a job reschedule itself, at can be invoked from within the
448           at-job. For example, this daily processing  script  named  my.daily
449           runs  every day (although crontab is a more appropriate vehicle for
450           such work):
451
452               # my.daily runs every day
453               daily processing
454               at now tomorrow < my.daily
455
456        4. The spacing of the three portions of the POSIX locale  timespec  is
457           quite  flexible  as  long  as there are no ambiguities. Examples of
458           various times and operand presentation include:
459
460               at 0815am Jan 24
461               at 8 :15amjan24
462               at now "+ 1day"
463               at 5 pm FRIday
464               at '17
465                   utc+
466                   30minutes'
467

RATIONALE

469       The at utility reads from standard input the commands to be executed at
470       a later time. It may be useful to redirect standard output and standard
471       error within the specified commands.
472
473       The −t time option was added as a new capability to support an interna‐
474       tionalized way of specifying a time for execution of the submitted job.
475
476       Early  proposals added a ``jobname'' concept as a way of giving submit‐
477       ted jobs names that are meaningful to the user  submitting  them.   The
478       historical,  system-specified at_job_id gives no indication of what the
479       job is. Upon further reflection, it was decided  that  the  benefit  of
480       this was not worth the change in historical interface. The at function‐
481       ality is useful in simple environments, but in large or complex  situa‐
482       tions,  the functionality provided by the Batch Services option is more
483       suitable.
484
485       The −q option historically has been an undocumented option, used mainly
486       by the batch utility.
487
488       The  System  V  −m  option  was added to provide a method for informing
489       users that an at-job had completed. Otherwise, users are only  informed
490       when output to standard error or standard output are not redirected.
491
492       The  behavior  of  at <now> was changed in an early proposal from being
493       unspecified to submitting a job for  potentially  immediate  execution.
494       Historical  BSD  at  implementations  support this. Historical System V
495       implementations give an error in that case, but a change to the  System
496       V versions should have no backwards-compatibility ramifications.
497
498       On BSD-based systems, a −u user option has allowed those with appropri‐
499       ate privileges to access the work of other users. Since this is primar‐
500       ily a system administration feature and is not universally implemented,
501       it has been omitted. Similarly, a specification for the  output  format
502       for  a  user  with  appropriate  privileges viewing the queues of other
503       users has been omitted.
504
505       The −f file option from System V is used instead of the BSD  method  of
506       using  the  last  operand as the pathname. The BSD method is ambiguous—
507       does:
508
509           at 1200 friday
510
511       mean the same thing if there is a file  named  friday  in  the  current
512       directory?
513
514       The  at_job_id  is  composed  of  a limited character set in historical
515       practice, and it is mandated here to invalidate systems that might  try
516       using characters that require shell quoting or that could not be easily
517       parsed by shell scripts.
518
519       The at utility varies between System V and BSD systems in the way time‐
520       zones are used. On System V systems, the TZ variable affects the at-job
521       submission times and the times displayed for the user. On BSD  systems,
522       TZ  is not taken into account. The BSD behavior is easily achieved with
523       the current specification. If the user  wishes  to  have  the  timezone
524       default to that of the system, they merely need to issue the at command
525       immediately following an unsetting or null assignment to TZ.  For exam‐
526       ple:
527
528           TZ= at noon ...
529
530       gives the desired BSD result.
531
532       While  the yacc-like grammar specified in the OPERANDS section is lexi‐
533       cally unambiguous with respect to the digit strings, a lexical analyzer
534       would probably be written to look for and return digit strings in those
535       cases. The parser could then check whether the digit string returned is
536       a valid day_number, year_number, and so on, based on the context.
537

FUTURE DIRECTIONS

539       None.
540

SEE ALSO

542       batch, crontab
543
544       The  Base  Definitions  volume  of POSIX.1‐2008, Chapter 8, Environment
545       Variables, Section 12.2, Utility Syntax Guidelines
546
548       Portions of this text are reprinted and reproduced in  electronic  form
549       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
550       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
551       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
552       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
553       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
554       event of any discrepancy between this version and the original IEEE and
555       The  Open Group Standard, the original IEEE and The Open Group Standard
556       is the referee document. The original Standard can be  obtained  online
557       at http://www.unix.org/online.html .
558
559       Any  typographical  or  formatting  errors that appear in this page are
560       most likely to have been introduced during the conversion of the source
561       files  to  man page format. To report such errors, see https://www.ker
562       nel.org/doc/man-pages/reporting_bugs.html .
563
564
565
566IEEE/The Open Group                  2013                               AT(1P)
Impressum