xref: /original-bsd/usr.bin/at/at/at.1 (revision e58c8952)
1.\" Copyright (c) 1980, 1990, 1993, 1994
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)at.1	8.3 (Berkeley) 04/18/94
7.\"
8.Dd
9.Dt AT 1
10.Os BSD 4
11.Sh NAME
12.Nm at
13.Nd schedule execution of commands `at' a given time
14.Sh SYNOPSIS
15.Nm at
16.Op Fl c
17.Op Fl m
18.Op Fl s
19.Ar time
20.Op Ar day
21.Op Ar command_file
22.Sh DESCRIPTION
23.Nm At
24schedules execution of commands at the specified
25.Ar time .
26The commands may be given to
27.Nm
28via the
29.Ar command_file
30or accepted from the standard input.
31.Nm At
32will pass these commands to the appropriate
33shell at the requested time. While awaiting
34execution, the jobs reside in a spool directory
35and may be examined by the
36.Xr atq 1
37program.
38.Pp
39Options available:
40.Bl -tag -width Ds
41.It Fl c
42.Ar Command_file
43contains
44.Xr csh 1
45commands.
46.It Fl s
47.Ar Command_file
48contains
49.Xr sh 1
50commands.
51.It Fl m
52Mail will be sent to the user after the job
53has been run. If errors occur during execution of the job, then
54a copy of the error diagnostics will be sent to the user. If
55no errors occur, then a short message is sent informing the
56user that no errors occurred.
57.El
58.Pp
59If a
60.Ar command_file
61is not specified,
62.Nm at
63prompts for commands from standard input until a
64.Ql \&^D
65is typed.
66.Pp
67The format of the spool file is as follows:
68a four line header that includes the owner of the job, the name of the job,
69the shell used to run the job, and whether mail will be
70sent after the job is executed. The header is followed by a
71.Nm cd
72command to the current directory and a
73.Nm umask
74command to set the modes on any files created by the job.
75.Nm At
76copies all relevant environment variables to the spool file.
77When the script is run, it uses the user and group ID
78of the creator of the spool file.
79.Pp
80The
81.Ar time
82is either a 24 hour military time
83.Em hhmm,
84where
85.Em hh
86is hour and
87.Em mm
88is minutes, or the traditional 12 hour time
89with qualifying options:
90.Pp
91.Bl -tag -width "am , a" -offset 12n -compact
92.It Li am , a
93am
94.It Li pm , p
95pm
96.It Li n
97noon
98.It Li m
99midnight
100.El
101.Pp
102The time can be abbreviated as shown below in EXAMPLES.
103.Pp
104A
105.Ar day
106of the week may be specified by the first two
107letters of its name. A week (7 days) may be specified by
108the argument
109.Ar week .
110If a month name is given, the following argument is expected to
111be the day (numeric).
112.Sh ENVIRONMENT
113If a shell is not specified,
114the current environment variable
115.Ev SHELL
116is used.
117.Sh EXAMPLES
118.Bl -tag -width Ds
119.It Li at 10p
120Execute at 10pm today, or tomorrow
121if 10pm has past. Use the shell
122found in the environment variable
123.Ev SHELL.
124.It Li at -c -m 1705 \&mo
125Execute at 5:05pm on Monday using
126.Xr csh 1
127and send mail upon completion or
128termination of the job.
129.It Li at -s -m 1200n week
130Execute at noon one week from today, using
131.Xr sh 1
132and send mail upon completion.
133.It Li at -s 8a apr 1
134Ideally this would be given late in March.  The
135commands would be run at 8 am on April first, using
136the
137.Xr sh 1 .
138.El
139.Sh ERRORS
140Errors must be collected via the
141.Fl m
142option or by redirecting the standard output
143from inside the
144.Ar command_file.
145.Sh FILES
146.Bl -tag -width /var/spool/at/yy.ddd.hhhh.* -compact
147.It Pa /var/spool/at
148spooling area
149.It Pa /var/spool/at/yy.ddd.hhhh.*
150job file
151.It Pa /var/spool/at/past
152directory where jobs are executed from
153.It Pa /var/spool/at/lasttimedone
154last time atrun was run
155.It Pa /var/libexec/atrun
156executor (run by
157.Xr cron 8 )
158.El
159.Sh SEE ALSO
160.Xr atq 1 ,
161.Xr atrm 1 ,
162.Xr calendar 1 ,
163.Xr cron 8
164.Xr sleep 1 ,
165.Sh DIAGNOSTICS
166Complains about various syntax errors and times out of range.
167.Sh BUGS
168The queueing mechanism
169.Pa /usr/libexec/atrun ,
170is scheduled by
171.Xr cron 8 .
172If it is run infrequently, a job may
173fall through the cracks.
174.Pp
175There are known problems attempting to specify
176a time of 2400 hours to
177.Nm at .
178.Pp
179If the system crashes, mail is not sent to the user informing them that
180the job was not completed.
181.Pp
182Sometimes old spool files are not removed from the directory
183.Pa /var/spool/at/past .
184This is usually due to a system crash,
185and requires that they be removed by hand.
186.Sh HISTORY
187An
188.Nm
189command appeared in Version 7 AT&T UNIX.
190