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