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