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

NAME

6       at - execute commands at a later time
7

SYNOPSIS

9       at [-m][-f file][-q queuename] -t time_arg
10
11       at [-m][-f file][-q queuename] timespec ...
12
13       at -r at_job_id ...
14
15       at -l -q queuename
16
17       at -l [at_job_id ...]
18
19

DESCRIPTION

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

OPTIONS

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

OPERANDS

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

STDIN

319       The standard input shall be a text file consisting of commands  accept‐
320       able  to the shell command language described in Shell Command Language
321       . The standard input shall only be used if no -f file option is  speci‐
322       fied.
323

INPUT FILES

325       See the STDIN section.
326
327       The  text  files /usr/lib/cron/at.allow and /usr/lib/cron/at.deny shall
328       contain zero or more user names,  one  per  line,  of  users  who  are,
329       respectively,  authorized  or  denied access to the at and batch utili‐
330       ties.
331

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

379       Default.
380

STDOUT

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

STDERR

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

OUTPUT FILES

415       None.
416

EXTENDED DESCRIPTION

418       None.
419

EXIT STATUS

421       The following exit values shall be returned:
422
423        0     The at utility successfully submitted, removed, or listed a  job
424              or jobs.
425
426       >0     An error occurred.
427
428

CONSEQUENCES OF ERRORS

430       The job shall not be scheduled, removed, or listed.
431
432       The following sections are informative.
433

APPLICATION USAGE

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

EXAMPLES

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

RATIONALE

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

FUTURE DIRECTIONS

569       None.
570

SEE ALSO

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