AT(1) BSD Reference Manual AT(1)NAME
at - schedule execution of commands `at' a given time
SYNOPSIS
at [-csm] time [date] [incr] [command_file]
at -l [job...]
at -r job...
atq [job...]
atrm job...
DESCRIPTION
At schedules execution of commands at the specified time. The commands
may be given to at via the command_file or accepted from the standard in-
put. At will pass these commands to the appropriate shell at the re-
quested time. While awaiting execution, the jobs reside in a spool di-
rectory and may be examined by the atq(1) program.
The options are as follows:
-c Command_file contains csh(1) commands.
-s Command_file contains sh(1) commands.
-m Mail will be sent to the user after the job has been run. If er-
rors occur during execution of the job, then a copy of the error
diagnostics will be sent to the user. If no errors occur, then a
short message is sent informing the user that no errors occurred.
-l List jobs in the queue. This is the same as atq.
-r Remove jobs from the queue. This is the same as atrm.
noarg When run by root with no arguments it checks the queue to see if
any items are ready to run.
If a command_file is not specified, at prompts for commands from standard
input until a `^D' (control-D) is typed.
The format of the spool file is as follows: A six line header that in-
cludes the owner of the job, the name of the job, the shell used to run
the job, whether mail will be sent after the job is executed, and a group
ID list. The job id and the time specified to execute the job are ex-
tracted from the filename.
The header is followed by the environment variables then a cd command to
the current directory and a umask command to set the modes on any files
created by the job.
When the script is run it uses the user and group ID of the creator of
the spool file.
The time and date parsing code is very forgiving. It should accept just
about anything reasonable you throw at it. It is meant to be compatible
with various known at date/time formats. Here are some guidelines:
The time is either a 24 hour military time hhmm, where hh is hour and mm
is minutes, or the traditional 12 hour time with qualifying options: am,
a; pm, p; noon, n; midnight, m.
The time can be abbreviated as shown below in EXAMPLES.
The date can be either: a day of the week specified by the first two,
three, or all letters of its name; or a month and/or day and/or year.
Examples: Mon; aug 12, 1993; aug 12; aug 1993. Months may be spelled out
or abbreviated to the first three letters.
The increment is simply a unit or the keyword ``next'' followed by a unit
or a plus sign ``+'' followed by an amount followed by a unit. Units are
minutes (or min), hours (or hr), days, weeks (or wk), fortnights, months,
or years with or without the ``s''. Examples: week; next wk; +10 weeks.
You may add spaces and commas as you like, for example: 8am aug 24, 1993;
8am,aug,24,1993,,,,; ,,,,8am,,,,,tue,,,,
Access control is implemented via the /usr/libexec/at_allowed script.
You can modify this script to customize access control to your needs.
The program is passed the user name as the only argument and should re-
turn a 0 if access is allowed; a 1 if access is denied. The default
script provided has the following properties: if neither
/var/spool/at/at.allow nor /var/spool/at/at.deny exist everyone is al-
lowed access (this is the way it should be configured when you first in-
stall); if either exist then access control is enabled and only the users
listed in /var/spool/at/at.allow are given access (unless that file ex-
ists but is empty, then all users are given access), negated by the list
of users in /var/spool/at/at.deny.
The format of /var/spool/at/at.allow and /var/spool/at/at.deny is user
names listed one to a line.
ENVIRONMENT
If a shell is not specified, the current environment variable SHELL is
used.
EXAMPLES
at 10p Execute at 10pm today, or tomorrow if 10pm has past. Use the
shell found in the environment variable SHELL.
at -c -m 1705 Mon
Execute at 5:05pm on Monday using csh(1) and send mail upon
completion or termination of the job.
at -s -m 1200n week
Use sh(1), send mail upon completion, start at noon o'clock,
one week from today.
at -s 8a apr 1
Ideally this would be given late in March. The commands
would be run at 8 am on April first, using the sh(1).
at 8a aug 27 + 1 fortnight /etc/spring_cleaning
At 8am + 1 fortnight the next Aug 27th run the command script
/etc/spring_cleaning. Not to be confused with at 8am the next
Aug 27th + 1 fortnight run the command. This means that the
year will be incremented unless 8a aug 27 is after the cur-
rent date. Hours and minutes work just the opposite, if you
say ``at 8a + 10 min'' and it's 8:05 the command will run in
5 minutes instead of 1 day + 5 minutes. You can always over-
ride this behaviour by specifying the date more exactly (e.g.
at 8:10 + 1 day).
ERRORS
Errors must be collected via the -m option or by redirecting the standard
output from inside the command_file.
FILES
/var/spool/at spooling area
/var/spool/at/job#.when job file
/var/spool/at/past directory where jobs are executed from
/var/spool/at/at.counter job counter
/var/spool/at/at.allow access control file
/var/spool/at/at.deny access control file
/usr/libexec/at_allowed access control script
SEE ALSOcalendar(1), sleep(1), setusercontext(3), cron(8)DIAGNOSTICS
Complains about various syntax errors and times out of range.
BUGS
The queueing mechanism is scheduled by cron(8). Job time granularity is
limited to how often it is run.
If the system crashes, mail is not sent to the user informing them that
the job was not completed.
Sometimes old spool files are not removed from the directory
/var/spool/at/past. This is usually due to a system crash, and requires
that they be removed by hand.
Every attempt possible was made to accept a wide range of date inputs
compatible with various versions of at. For maximum portability use few-
er features.
HISTORY
An at command appeared in Version 7 AT&T UNIX. This at command was
rewritten for BSDI.
BSDI BSD/OS August 26, 1992 3