1.\" $FreeBSD$ 2.Dd January 13, 2002 3.Dt "AT" 1 4.Os 5.Sh NAME 6.Nm at , 7.Nm batch , 8.Nm atq , 9.Nm atrm 10.Nd queue, examine or delete jobs for later execution 11.Sh SYNOPSIS 12.Nm at 13.Op Fl q Ar queue 14.Op Fl f Ar file 15.Op Fl mldbv 16.Ar time 17.Nm at 18.Op Fl q Ar queue 19.Op Fl f Ar file 20.Op Fl mldbv 21.Fl t 22.Sm off 23.Op Oo Ar CC Oc Ar YY 24.Ar MM DD hh mm Op . Ar SS 25.Sm on 26.Nm at 27.Fl c Ar job Op Ar job ... 28.Nm at 29.Fl l Op Ar job ... 30.Nm at 31.Fl l 32.Fl q Ar queue 33.Nm at 34.Fl r Ar job Op Ar job ... 35.Pp 36.Nm atq 37.Op Fl q Ar queue 38.Op Fl v 39.Pp 40.Nm atrm 41.Ar job 42.Op Ar job ... 43.Pp 44.Nm batch 45.Op Fl q Ar queue 46.Op Fl f Ar file 47.Op Fl mv 48.Op Ar time 49.Sh DESCRIPTION 50.Nm \&At 51and 52.Nm batch 53read commands from standard input or a specified file which are to 54be executed at a later time, using 55.Xr sh 1 . 56.Bl -tag -width indent 57.It Nm at 58executes commands at a specified time; 59.It Nm atq 60lists the user's pending jobs, unless the user is the superuser; in that 61case, everybody's jobs are listed; 62.It Nm atrm 63deletes jobs; 64.It Nm batch 65executes commands when system load levels permit; in other words, when the load average 66drops below _LOADAVG_MX, or the value specified in the invocation of 67.Nm atrun . 68.El 69.Pp 70.Nm \&At 71allows some moderately complex 72.Ar time 73specifications. 74It accepts times of the form 75.Ar HHMM 76or 77.Ar HH:MM 78to run a job at a specific time of day. 79(If that time is already past, the next day is assumed.) 80As an alternative, the following keywords may be specified: 81.Em midnight , 82.Em noon , 83or 84.Em teatime 85(4pm) 86and time-of-day may be suffixed with 87.Em AM 88or 89.Em PM 90for running in the morning or the evening. 91The day on which the job is to be run may also be specified 92by giving a date in the form 93.Ar \%month-name day 94with an optional 95.Ar year , 96or giving a date of the forms 97.Ar DD.MM.YYYY , 98.Ar DD.MM.YY , 99.Ar MM/DD/YYYY , 100.Ar MM/DD/YY , 101.Ar MMDDYYYY , or 102.Ar MMDDYY . 103The specification of a date must follow the specification of 104the time of day. 105Time can also be specified as: 106.Op Em now 107.Em + Ar count \%time-units , 108where the time-units can be 109.Em minutes , 110.Em hours , 111.Em days , 112.Em weeks , 113.Em months 114or 115.Em years 116and 117.Nm 118may be told to run the job today by suffixing the time with 119.Em today 120and to run the job tomorrow by suffixing the time with 121.Em tomorrow . 122.Pp 123For example, to run a job at 4pm three days from now, use 124.Nm at Ar 4pm + 3 days , 125to run a job at 10:00am on July 31, use 126.Nm at Ar 10am Jul 31 127and to run a job at 1am tomorrow, use 128.Nm at Ar 1am tomorrow . 129.Pp 130The 131.Nm at 132utility also supports the \*[Px] time format (see 133.Fl t 134option). 135.Pp 136For both 137.Nm 138and 139.Nm batch , 140commands are read from standard input or the file specified 141with the 142.Fl f 143option and executed. 144The working directory, the environment (except for the variables 145.Ev TERM , 146.Ev TERMCAP , 147.Ev DISPLAY 148and 149.Em _ ) 150and the 151.Ar umask 152are retained from the time of invocation. 153An 154.Nm 155or 156.Nm batch 157command invoked from a 158.Xr su 1 159shell will retain the current userid. 160The user will be mailed standard error and standard output from his 161commands, if any. 162Mail will be sent using the command 163.Xr sendmail 8 . 164If 165.Nm 166is executed from a 167.Xr su 1 168shell, the owner of the login shell will receive the mail. 169.Pp 170The superuser may use these commands in any case. 171For other users, permission to use 172.Nm 173is determined by the files 174.Pa _PERM_PATH/at.allow 175and 176.Pa _PERM_PATH/at.deny . 177.Pp 178If the file 179.Pa _PERM_PATH/at.allow 180exists, only usernames mentioned in it are allowed to use 181.Nm . 182.Pp 183If 184.Pa _PERM_PATH/at.allow 185does not exist, 186.Pa _PERM_PATH/at.deny 187is checked, every username not mentioned in it is then allowed 188to use 189.Nm Ns . 190.Pp 191If neither exists, only the superuser is allowed use of 192.Nm Ns . 193This is the default configuration. 194.Sh IMPLEMENTATION NOTES 195Note that 196.Nm 197is implemented through the 198.Xr cron 8 199daemon by calling 200.Xr atrun 8 201every five minutes. 202This implies that the granularity of 203.Nm 204might not be optimal for every deployment. 205If a finer granularity is needed the system crontab at 206.Pa /etc/crontab 207needs to be changed. 208.Sh OPTIONS 209.Bl -tag -width indent 210.It Fl q Ar queue 211Use the specified queue. 212A queue designation consists of a single letter; valid queue designations 213range from 214.Ar a 215to 216.Ar z 217and 218.Ar A 219to 220.Ar Z . 221The 222.Ar _DEFAULT_AT_QUEUE 223queue is the default for 224.Nm 225and the 226.Ar _DEFAULT_BATCH_QUEUE 227queue for 228.Nm batch . 229Queues with higher letters run with increased niceness. 230If a job is submitted to a queue designated with an uppercase letter, it 231is treated as if it had been submitted to batch at that time. 232If 233.Nm atq 234is given a specific queue, it will only show jobs pending in that queue. 235.It Fl m 236Send mail to the user when the job has completed even if there was no 237output. 238.It Fl f Ar file 239Read the job from 240.Ar file 241rather than standard input. 242.It Fl l 243With no arguments, list all jobs for the invoking user. If one or more 244job numbers are given, list only those jobs. 245.It Fl d 246Is an alias for 247.Nm atrm 248(this option is deprecated; use 249.Fl r 250instead). 251.It Fl b 252Is an alias for 253.Nm batch . 254.It Fl v 255For 256.Nm atq , 257shows completed but not yet deleted jobs in the queue; otherwise 258shows the time the job will be executed. 259.It Fl c 260Cat the jobs listed on the command line to standard output. 261.It Fl r 262Remove the specified jobs. 263.It Fl t 264Specify the job time using the \*[Px] time format. 265The argument should be in the form 266.Sm off 267.Op Oo Ar CC Oc Ar YY 268.Ar MM DD hh mm Op . Ar SS 269.Sm on 270where each pair of letters represents the following: 271.Pp 272.Bl -tag -width indent -compact -offset indent 273.It Ar CC 274The first two digits of the year (the century). 275.It Ar YY 276The second two digits of the year. 277.It Ar MM 278The month of the year, from 1 to 12. 279.It Ar DD 280the day of the month, from 1 to 31. 281.It Ar hh 282The hour of the day, from 0 to 23. 283.It Ar mm 284The minute of the hour, from 0 to 59. 285.It Ar SS 286The second of the minute, from 0 to 61. 287.El 288.Pp 289If the 290.Ar CC 291and 292.Ar YY 293letter pairs are not specified, the values default to the current 294year. 295If the 296.Ar SS 297letter pair is not specified, the value defaults to 0. 298.El 299.Sh FILES 300.Bl -tag -width _ATJOB_DIR/_LOCKFILE -compact 301.It Pa _ATJOB_DIR 302directory containing job files 303.It Pa _ATSPOOL_DIR 304directory containing output spool files 305.It Pa /var/run/utmp 306login records 307.It Pa _PERM_PATH/at.allow 308allow permission control 309.It Pa _PERM_PATH/at.deny 310deny permission control 311.It Pa _ATJOB_DIR/_LOCKFILE 312job-creation lock file 313.El 314.Sh SEE ALSO 315.Xr nice 1 , 316.Xr sh 1 , 317.Xr umask 2 , 318.Xr atrun 8 , 319.Xr cron 8 , 320.Xr sendmail 8 321.Sh BUGS 322If the file 323.Pa /var/run/utmp 324is not available or corrupted, or if the user is not logged on at the 325time 326.Nm 327is invoked, the mail is sent to the userid found 328in the environment variable 329.Ev LOGNAME . 330If that is undefined or empty, the current userid is assumed. 331.Pp 332.Nm \&At 333and 334.Nm batch 335as presently implemented are not suitable when users are competing for 336resources. 337If this is the case, another batch system such as 338.Em nqs 339may be more suitable. 340.Pp 341Specifying a date past 2038 may not work on some systems. 342.Sh AUTHORS 343At was mostly written by 344.An Thomas Koenig Aq ig25@rz.uni-karlsruhe.de . 345The time parsing routines are by 346.An David Parsons Aq orc@pell.chi.il.us , 347with minor enhancements by 348.An Joe Halpin Aq joe.halpin@attbi.com . 349