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

NAME

12       at - execute commands at a later time
13

SYNOPSIS

15       at [-m][-f file][-q queuename] -t time_arg
16
17       at [-m][-f file][-q queuename] timespec ...
18
19       at -r at_job_id ...
20
21       at -l -q queuename
22
23       at -l [at_job_id ...]
24
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       /usr/lib/cron/at.allow.  If  that  file  does  not  exist,   the   file
48       /usr/lib/cron/at.deny  shall  be  checked to determine whether the user
49       shall be denied access to at. If neither file exists,  only  a  process
50       with  the  appropriate  privileges shall be allowed to submit a job. If
51       only at.deny exists and is empty, global usage shall be permitted.  The
52       at.allow and at.deny files shall consist of one user name per line.
53

OPTIONS

55       The  at  utility  shall  conform  to  the  Base  Definitions  volume of
56       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
57
58       The following options shall be supported:
59
60       -f  file
61              Specify the pathname of a file to be used as the source  of  the
62              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  are
66              specified,  report  only  information for these jobs. The output
67              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 job
73              produces no output.
74
75       If -m is not used, the job's standard output and standard  error  shall
76       be  provided  to  the user by means of mail, unless they are redirected
77       elsewhere; if there is no such output to  provide,  the  implementation
78       need not notify the user of the job's completion.
79
80       -q  queuename
81
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  batch.
86              The meanings of all other queuenames are implementation-defined.
87              If -q is specified along with either of the -t time_arg or time‐
88              spec arguments, the results are unspecified.
89
90       -r     Remove  the jobs with the specified at_job_id operands that were
91              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 for‐
96              mat as specified by the touch -t time utility.
97
98

OPERANDS

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

STDIN

325       The  standard input shall be a text file consisting of commands accept‐
326       able to the shell command language described in Shell Command  Language
327       .  The standard input shall only be used if no -f file option is speci‐
328       fied.
329

INPUT FILES

331       See the STDIN section.
332
333       The text files /usr/lib/cron/at.allow and  /usr/lib/cron/at.deny  shall
334       contain  zero  or  more  user  names,  one  per line, of users who are,
335       respectively, authorized or denied access to the at  and  batch  utili‐
336       ties.
337

ENVIRONMENT VARIABLES

339       The following environment variables shall affect the execution of at:
340
341       LANG   Provide  a  default value for the internationalization variables
342              that are unset or null. (See  the  Base  Definitions  volume  of
343              IEEE Std 1003.1-2001,  Section  8.2,  Internationalization Vari‐
344              ables for the precedence of internationalization variables  used
345              to determine the values of locale categories.)
346
347       LC_ALL If  set  to a non-empty string value, override the values of all
348              the other internationalization variables.
349
350       LC_CTYPE
351              Determine the locale for  the  interpretation  of  sequences  of
352              bytes  of  text  data as characters (for example, single-byte as
353              opposed to multi-byte characters in arguments and input files).
354
355       LC_MESSAGES
356              Determine the locale that should be used to  affect  the  format
357              and  contents  of  diagnostic messages written to standard error
358              and informative messages written to standard output.
359
360       NLSPATH
361              Determine the location of message catalogs for the processing of
362              LC_MESSAGES .
363
364       LC_TIME
365              Determine  the  format  and  contents  for date and time strings
366              written and accepted by at.
367
368       SHELL  Determine a name of a command interpreter to be used  to  invoke
369              the  at-job. If the variable is unset or null, sh shall be used.
370              If it is set to a value other than a name for sh, the  implemen‐
371              tation  shall  do  one of the following: use that shell; use sh;
372              use the login shell from the user database; or any of  the  pre‐
373              ceding  accompanied by a warning diagnostic about which was cho‐
374              sen.
375
376       TZ     Determine the timezone. The job shall be submitted for execution
377              at  the  time  specified  by timespec or -t time relative to the
378              timezone specified by the TZ variable.  If timespec specifies  a
379              timezone,  it shall override TZ.  If timespec does not specify a
380              timezone and TZ is unset or null, an unspecified  default  time‐
381              zone shall be used.
382
383

ASYNCHRONOUS EVENTS

385       Default.
386

STDOUT

388       When  standard  input  is a terminal, prompts of unspecified format for
389       each line of the user input described in the STDIN section may be writ‐
390       ten to standard output.
391
392       In  the  POSIX  locale,  the following shall be written to the standard
393       output for each job when jobs are listed in response to the -l option:
394
395
396              "%s\t%s\n", at_job_id, <date>
397
398       where date shall be equivalent in format to the output of:
399
400
401              date +"%a %b %e %T %Y"
402
403       The date and time written shall be adjusted so that they appear in  the
404       timezone of the user (as determined by the TZ variable).
405

STDERR

407       In  the  POSIX locale, the following shall be written to standard error
408       when a job has been successfully submitted:
409
410
411              "job %s at %s\n", at_job_id, <date>
412
413       where date has the same format as that described in the STDOUT section.
414       Neither this, nor warning messages concerning the selection of the com‐
415       mand interpreter, shall be considered a  diagnostic  that  changes  the
416       exit status.
417
418       Diagnostic messages, if any, shall be written to standard error.
419

OUTPUT FILES

421       None.
422

EXTENDED DESCRIPTION

424       None.
425

EXIT STATUS

427       The following exit values shall be returned:
428
429        0     The  at utility successfully submitted, removed, or listed a job
430              or jobs.
431
432       >0     An error occurred.
433
434

CONSEQUENCES OF ERRORS

436       The job shall not be scheduled, removed, or listed.
437
438       The following sections are informative.
439

APPLICATION USAGE

441       The format of the at command line shown here is guaranteed only for the
442       POSIX  locale.  Other cultures may be supported with substantially dif‐
443       ferent interfaces, although implementations are encouraged  to  provide
444       comparable levels of functionality.
445
446       Since  the  commands  run  in a separate shell invocation, running in a
447       separate process group with no controlling terminal, open file descrip‐
448       tors,  traps,  and priority inherited from the invoking environment are
449       lost.
450
451       Some implementations do not  allow  substitution  of  different  shells
452       using  SHELL.  System V systems, for example, have used the login shell
453       value for the user in /etc/passwd. To select reliably  another  command
454       interpreter, the user must include it as part of the script, such as:
455
456
457              $ at 1800
458              myshell myscript
459              EOT
460              job ... at ...
461              $
462

EXAMPLES

464        1. This sequence can be used at a terminal:
465
466
467           at -m 0730 tomorrow
468           sort < file >outfile
469           EOT
470
471        2. This  sequence,  which demonstrates redirecting standard error to a
472           pipe, is useful in a command procedure (the sequence of output  re‐
473           direction specifications is significant):
474
475
476           at now + 1 hour <<!
477           diff file1 file2 2>&1 >outfile | mailx mygroup
478           !
479
480        3. To  have a job reschedule itself, at can be invoked from within the
481           at-job. For example, this daily processing  script  named  my.daily
482           runs  every day (although crontab is a more appropriate vehicle for
483           such work):
484
485
486           # my.daily runs every day
487           daily processingat now tomorrow < my.daily
488
489        4. The spacing of the three portions of the POSIX locale  timespec  is
490           quite  flexible  as  long as there are no ambiguities.  Examples of
491           various times and operand presentation include:
492
493
494           at 0815am Jan 24
495           at 8 :15amjan24
496           at now "+ 1day"
497           at 5 pm FRIday
498           at '17
499               utc+
500               30minutes'
501

RATIONALE

503       The at utility reads from standard input the commands to be executed at
504       a later time. It may be useful to redirect standard output and standard
505       error within the specified commands.
506
507       The -t time option was added as a new capability to support an interna‐
508       tionalized way of specifying a time for execution of the submitted job.
509
510       Early  proposals added a "jobname" concept as a way of giving submitted
511       jobs names that are meaningful to the user submitting them. The histor‐
512       ical,  system-specified  at_job_id  gives no indication of what the job
513       is. Upon further reflection, it was decided that the  benefit  of  this
514       was  not worth the change in historical interface. The at functionality
515       is useful in simple environments, but in large or  complex  situations,
516       the  functionality  provided by the Batch Services option is more suit‐
517       able.
518
519       The -q option historically has been an undocumented option, used mainly
520       by the batch utility.
521
522       The  System  V  -m  option  was added to provide a method for informing
523       users that an at-job had completed. Otherwise, users are only  informed
524       when output to standard error or standard output are not redirected.
525
526       The  behavior  of  at <now> was changed in an early proposal from being
527       unspecified to submitting a job for  potentially  immediate  execution.
528       Historical  BSD  at  implementations  support this. Historical System V
529       implementations give an error in that case, but a change to the  System
530       V versions should have no backwards-compatibility ramifications.
531
532       On BSD-based systems, a -u user option has allowed those with appropri‐
533       ate privileges to access the work of other users. Since this is primar‐
534       ily a system administration feature and is not universally implemented,
535       it has been omitted. Similarly, a specification for the  output  format
536       for  a  user  with  appropriate  privileges viewing the queues of other
537       users has been omitted.
538
539       The -f file option from System V is used instead of the BSD  method  of
540       using  the  last  operand as the pathname. The BSD method is ambiguous-
541       does:
542
543
544              at 1200 friday
545
546       mean the same thing if there is a file  named  friday  in  the  current
547       directory?
548
549       The  at_job_id  is  composed  of  a limited character set in historical
550       practice, and it is mandated here to invalidate systems that might  try
551       using characters that require shell quoting or that could not be easily
552       parsed by shell scripts.
553
554       The at utility varies between System V and BSD systems in the way time‐
555       zones are used. On System V systems, the TZ variable affects the at-job
556       submission times and the times displayed for the user. On BSD  systems,
557       TZ  is not taken into account. The BSD behavior is easily achieved with
558       the current specification.  If the user wishes  to  have  the  timezone
559       default to that of the system, they merely need to issue the at command
560       immediately following an unsetting or null assignment to TZ . For exam‐
561       ple:
562
563
564              TZ= at noon ...
565
566       gives the desired BSD result.
567
568       While  the yacc-like grammar specified in the OPERANDS section is lexi‐
569       cally unambiguous with respect to the digit strings, a lexical analyzer
570       would probably be written to look for and return digit strings in those
571       cases. The parser could then check whether the digit string returned is
572       a valid day_number, year_number, and so on, based on the context.
573

FUTURE DIRECTIONS

575       None.
576

SEE ALSO

578       batch, crontab
579
581       Portions  of  this text are reprinted and reproduced in electronic form
582       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
583       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
584       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
585       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
586       event of any discrepancy between this version and the original IEEE and
587       The  Open Group Standard, the original IEEE and The Open Group Standard
588       is the referee document. The original Standard can be  obtained  online
589       at http://www.opengroup.org/unix/online.html .
590
591
592
593IEEE/The Open Group                  2003                               AT(1P)
Impressum