xref: /original-bsd/usr.bin/at/at/at.1 (revision 3b6250d9)
1.\" Copyright (c) 1980, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)at.1	6.5 (Berkeley) 03/14/91
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
130Use
131.Xr sh 1 ,
132send mail upon completetion, start at noon o'clock,
133one week from today.
134.It Li at -s 8a apr 1
135Ideally this would be given late in March.  The
136commands would be run at 8 am on April first, using
137the
138.Xr sh 1 .
139.El
140.Sh ERRORS
141Errors must be collected via the
142.Fl m
143option or by redirecting the standard output
144from inside the
145.Ar command_file.
146.Sh FILES
147.Bl -tag -width /var/spool/at/yy.ddd.hhhh.* -compact
148.It Pa /var/spool/at
149spooling area
150.It Pa /var/spool/at/yy.ddd.hhhh.*
151job file
152.It Pa /var/spool/at/past
153directory where jobs are executed from
154.It Pa /var/spool/at/lasttimedone
155last time atrun was run
156.It Pa /var/libexec/atrun
157executor (run by
158.Xr cron 8 )
159.El
160.Sh SEE ALSO
161.Xr atq 1 ,
162.Xr atrm 1 ,
163.Xr calendar 1 ,
164.Xr cron 8
165.Xr sleep 1 ,
166.Sh DIAGNOSTICS
167Complains about various syntax errors and times out of range.
168.Sh BUGS
169The queueing mechanism
170.Pa /usr/libexec/atrun ,
171is scheduled by
172.Xr cron 8 .
173If it is run infrequently, a job may
174fall thru the cracks.
175.Pp
176There are known problems attempting to specify
177a time of 2400 hours to
178.Nm at .
179.Pp
180If the system crashes, mail is not sent to the user informing them that
181the job was not completed.
182.Pp
183Sometimes old spool files are not removed from the directory
184.Pa /var/spool/at/past .
185This is usually due to a system crash,
186and requires that they be removed by hand.
187.Sh HISTORY
188An
189.Nm
190command appeared in Version 7 AT&T UNIX.
191