xref: /original-bsd/usr.bin/at/at/at.1 (revision e61fc7ea)
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.4 (Berkeley) 07/24/90
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 s
18.Op Fl m
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.Pp
41.Tp Fl c
42.Ar Command_file
43contains
44.Xr csh 1
45commands.
46.Tp Fl s
47.Ar Command_file
48contains
49.Xr sh 1
50commands.
51.Tp 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.Tp
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.
75Then
76.Nm at
77copies all relevant environment variables to the spool file.
78When the script is run, it uses the user and group ID
79of the creator of the spool file.
80.Pp
81The
82.Ar time
83is either a 24 hour military time
84.Em hhmm,
85where
86.Em hh
87is hour and
88.Em mm
89is minutes, or the traditional 12 hour time
90with qualifying options:
91.Df I
92.Dp Li am , a
93am
94.Dp Li pm , p
95pm
96.Dp Li n
97noon
98.Dp Li m
99midnight
100.Dp
101.De
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.Em 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.Pp
119.Tw Ar
120.Tp Li at 10p
121Execute at 10pm today, or tomorrow
122if 10pm has past. Use the shell
123found in the environment variable
124.Ev SHELL.
125.Tp Li at -c -m 1705 mo
126Execute at 5:05pm on Monday using
127.Xr csh 1
128and send mail upon completion or
129termination of the job.
130.Tp Li at -s -m 1200n week
131Use
132.Xr sh 1 ,
133send mail upon completetion, start at noon o'clock,
134one week from today.
135.Tp Li at -s 8a apr 1
136Ideally this would be given late in March.  The
137commands would be run at 8 am on April first, using
138the
139.Xr sh 1 .
140.Tp
141.Sh ERRORS
142Errors must be collected via the
143.Fl m
144option or by redirecting the standard output
145from inside the
146.Ar command_file.
147.Sh FILES
148.Dw /var/spool/at/yy.ddd.hhhh.*
149.Di L
150.Dp Pa /var/spool/at
151spooling area
152.Dp Pa /var/spool/at/yy.ddd.hhhh.*
153job file
154.Dp Pa /var/spool/at/past
155directory where jobs are executed from
156.Dp Pa /var/spool/at/lasttimedone
157last time atrun was run
158.Dp Pa /var/libexec/atrun
159executor (run by
160.Xr cron 8 )
161.Dp
162.Sh SEE ALSO
163.Xr atq 1 ,
164.Xr atrm 1 ,
165.Xr calendar 1 ,
166.Xr cron 8
167.Xr sleep 1 ,
168.Sh DIAGNOSTICS
169Complains about various syntax errors and times out of range.
170.Sh HISTORY
171.Nm At
172appeared in Version 7 AT&T UNIX.
173.Sh BUGS
174The queueing mechanism
175.Pa /usr/libexec/atrun ,
176is scheduled by
177.Xr cron 8 .
178Frequency with which
179.Xr cron 8
180runs
181.Pa /usr/libexec/atrun
182is site dependent.
183If it is run infrequently, a job may
184fall thru the cracks.
185.Pp
186There are known problems attempting to specify
187a time of 2400 hours to
188.Nm at .
189.Pp
190If the system crashes, mail is not sent to the user informing them that
191the job was not completed.
192.Pp
193Sometimes old spool files are not removed from the directory
194.Pa /var/spool/at/past .
195This is usually due to a system crash,
196and requires that they be removed by hand.
197