1258945Sroberto.Dd September 18, 2023 2280849Scy.Dt "AT" 1 3258945Sroberto.Os 4258945Sroberto.Sh NAME 5258945Sroberto.Nm at , 6258945Sroberto.Nm batch , 7258945Sroberto.Nm atq , 8258945Sroberto.Nm atrm 9258945Sroberto.Nd queue, examine or delete jobs for later execution 10258945Sroberto.Sh SYNOPSIS 11258945Sroberto.Nm at 12258945Sroberto.Op Fl q Ar queue 13258945Sroberto.Op Fl f Ar file 14258945Sroberto.Op Fl mldbv 15258945Sroberto.Ar time 16258945Sroberto.Nm at 17258945Sroberto.Op Fl q Ar queue 18280849Scy.Op Fl f Ar file 19258945Sroberto.Op Fl mldbv 20258945Sroberto.Fl t 21258945Sroberto.Sm off 22258945Sroberto.Op Oo Ar CC Oc Ar YY 23258945Sroberto.Ar MM DD hh mm Op . Ar SS 24258945Sroberto.Sm on 25258945Sroberto.Nm at 26258945Sroberto.Fl c Ar job Op Ar job ... 27258945Sroberto.Nm at 28258945Sroberto.Fl l Op Ar job ... 29258945Sroberto.Nm at 30258945Sroberto.Fl l 31258945Sroberto.Fl q Ar queue 32258945Sroberto.Nm at 33258945Sroberto.Fl r Ar job Op Ar job ... 34280849Scy.Pp 35258945Sroberto.Nm atq 36258945Sroberto.Op Fl q Ar queue 37258945Sroberto.Op Fl v 38258945Sroberto.Pp 39258945Sroberto.Nm atrm 40258945Sroberto.Ar job 41258945Sroberto.Op Ar job ... 42258945Sroberto.Pp 43258945Sroberto.Nm batch 44258945Sroberto.Op Fl q Ar queue 45258945Sroberto.Op Fl f Ar file 46258945Sroberto.Op Fl mv 47258945Sroberto.Op Ar time 48258945Sroberto.Sh DESCRIPTION 49258945SrobertoThe 50258945Sroberto.Nm at 51258945Srobertoand 52258945Sroberto.Nm batch 53258945Srobertoutilities 54258945Srobertoread commands from standard input or a specified file which are to 55258945Srobertobe executed at a later time, using 56258945Sroberto.Xr sh 1 . 57258945Sroberto.Bl -tag -width indent 58258945Sroberto.It Nm at 59258945Srobertoexecutes commands at a specified time; 60258945Sroberto.It Nm atq 61258945Srobertolists the user's pending jobs, unless the user is the superuser; in that 62258945Srobertocase, everybody's jobs are listed; 63258945Sroberto.It Nm atrm 64258945Srobertodeletes jobs; 65258945Sroberto.It Nm batch 66258945Srobertoexecutes commands when system load levels permit; in other words, when 67258945Srobertothe load average drops below _LOADAVG_MX times number of active CPUs, 68258945Srobertoor the value specified in the invocation of 69258945Sroberto.Nm atrun . 70258945Sroberto.El 71258945Sroberto.Pp 72258945SrobertoThe 73280849Scy.Nm at 74280849Scyutility allows some moderately complex 75280849Scy.Ar time 76280849Scyspecifications. 77258945SrobertoIt accepts times of the form 78258945Sroberto.Ar HHMM 79258945Srobertoor 80258945Sroberto.Ar HH:MM 81258945Srobertoto run a job at a specific time of day. 82258945Sroberto(If that time is already past, the next day is assumed.) 83258945SrobertoAs an alternative, the following keywords may be specified: 84258945Sroberto.Cm midnight , 85258945Sroberto.Cm noon , 86258945Srobertoor 87258945Sroberto.Cm teatime 88258945Sroberto(4pm) 89258945Srobertoand time-of-day may be suffixed with 90258945Sroberto.Cm AM 91258945Srobertoor 92258945Sroberto.Cm PM 93258945Srobertofor running in the morning or the evening. 94258945SrobertoThe day on which the job is to be run may also be specified 95258945Srobertoby giving a date in the form 96258945Sroberto.Ar \%month-name day 97258945Srobertowith an optional 98258945Sroberto.Ar year , 99258945Srobertoor giving a date of the forms 100258945Sroberto.Ar DD.MM.YYYY , 101258945Sroberto.Ar DD.MM.YY , 102258945Sroberto.Ar MM/DD/YYYY , 103258945Sroberto.Ar MM/DD/YY , 104258945Sroberto.Ar MMDDYYYY , 105258945Srobertoor 106258945Sroberto.Ar MMDDYY . 107258945SrobertoThe specification of a date must follow the specification of 108258945Srobertothe time of day. 109258945SrobertoTime can also be specified as: 110258945Sroberto.Op Cm now 111258945Sroberto.Cm \&+ Ar count \%time-units , 112258945Srobertowhere the time-units can be 113258945Sroberto.Cm minutes , 114258945Sroberto.Cm hours , 115258945Sroberto.Cm days , 116258945Sroberto.Cm weeks , 117258945Sroberto.Cm months 118258945Srobertoor 119258945Sroberto.Cm years 120258945Srobertoand 121258945Sroberto.Nm 122258945Srobertomay be told to run the job today by suffixing the time with 123258945Sroberto.Cm today 124258945Srobertoand to run the job tomorrow by suffixing the time with 125258945Sroberto.Cm tomorrow . 126258945Sroberto.Pp 127258945SrobertoThe 128258945Sroberto.Nm at 129258945Srobertoutility also supports the 130258945Sroberto.Tn POSIX 131258945Srobertotime format (see 132258945Sroberto.Fl t 133258945Srobertooption). 134258945Sroberto.Pp 135258945SrobertoFor both 136258945Sroberto.Nm 137258945Srobertoand 138258945Sroberto.Nm batch , 139258945Srobertocommands are read from standard input or the file specified 140258945Srobertowith the 141258945Sroberto.Fl f 142258945Srobertooption and executed. 143258945SrobertoThe working directory, the environment (except for the variables 144258945Sroberto.Ev TERM , 145258945Sroberto.Ev TERMCAP , 146258945Sroberto.Ev DISPLAY 147258945Srobertoand 148258945Sroberto.Ev _ ) 149258945Srobertoand the 150258945Sroberto.Ar umask 151258945Srobertoare retained from the time of invocation. 152258945SrobertoAn 153258945Sroberto.Nm 154258945Srobertoor 155258945Sroberto.Nm batch 156258945Srobertocommand invoked from a 157258945Sroberto.Xr su 1 158258945Srobertoshell will retain the current userid. 159258945SrobertoThe user will be mailed standard error and standard output from his 160258945Srobertocommands, if any. 161258945SrobertoMail will be sent using the command 162293650Sglebius.Xr sendmail 8 . 163258945SrobertoIf 164258945Sroberto.Nm 165258945Srobertois executed from a 166258945Sroberto.Xr su 1 167258945Srobertoshell, the owner of the login shell will receive the mail. 168258945Sroberto.Pp 169258945SrobertoThe superuser may use these commands in any case. 170258945SrobertoFor other users, permission to use 171258945Sroberto.Nm 172258945Srobertois determined by the files 173258945Sroberto.Pa _PERM_PATH/at.allow 174258945Srobertoand 175258945Sroberto.Pa _PERM_PATH/at.deny . 176258945Sroberto.Pp 177258945SrobertoIf the file 178258945Sroberto.Pa _PERM_PATH/at.allow 179258945Srobertoexists, only usernames mentioned in it are allowed to use 180258945Sroberto.Nm . 181258945SrobertoIn these two files, a user is considered to be listed only if the user 182258945Srobertoname has no blank or other characters before it on its line and a 183258945Srobertonewline character immediately after the name, even at the end of 184258945Srobertothe file. 185258945SrobertoOther lines are ignored and may be used for comments. 186258945Sroberto.Pp 187258945SrobertoIf 188258945Sroberto.Pa _PERM_PATH/at.allow 189258945Srobertodoes not exist, 190280849Scy.Pa _PERM_PATH/at.deny 191280849Scyis checked, every username not mentioned in it is then allowed 192280849Scyto use 193258945Sroberto.Nm . 194258945Sroberto.Pp 195258945SrobertoIf neither exists, only the superuser is allowed use of 196258945Sroberto.Nm . 197258945SrobertoThis is the default configuration. 198258945Sroberto.Sh IMPLEMENTATION NOTES 199258945SrobertoNote that 200258945Sroberto.Nm 201258945Srobertois implemented through the 202258945Sroberto.Xr cron 8 203258945Srobertodaemon by calling 204258945Sroberto.Xr atrun 8 205280849Scyevery five minutes. 206258945SrobertoThis implies that the granularity of 207258945Sroberto.Nm 208280849Scymight not be optimal for every deployment. 209258945SrobertoIf a finer granularity is desired, the 210258945Sroberto.Pa /etc/cron.d/at 211258945Srobertofile can be edited and will be read by the system crontab, from which 212258945Srobertothe 213258945Sroberto.Ev SHELL 214258945Srobertoand 215258945Sroberto.Ev PATH 216258945Srobertoenvironment variables are inherited. 217258945Sroberto.Sh OPTIONS 218280849Scy.Bl -tag -width indent 219258945Sroberto.It Fl q Ar queue 220258945SrobertoUse the specified queue. 221258945SrobertoA queue designation consists of a single letter; valid queue designations 222258945Srobertorange from 223258945Sroberto.Ar a 224258945Srobertoto 225258945Sroberto.Ar z 226258945Srobertoand 227258945Sroberto.Ar A 228258945Srobertoto 229258945Sroberto.Ar Z . 230258945SrobertoThe 231258945Sroberto.Ar _DEFAULT_AT_QUEUE 232258945Srobertoqueue is the default for 233258945Sroberto.Nm 234258945Srobertoand the 235258945Sroberto.Ar _DEFAULT_BATCH_QUEUE 236258945Srobertoqueue for 237258945Sroberto.Nm batch . 238258945SrobertoQueues with higher letters run with increased niceness. 239258945SrobertoIf a job is submitted to a queue designated with an uppercase letter, it 240258945Srobertois treated as if it had been submitted to batch at that time. 241258945SrobertoIf 242258945Sroberto.Nm atq 243258945Srobertois given a specific queue, it will only show jobs pending in that queue. 244258945Sroberto.It Fl m 245258945SrobertoSend mail to the user when the job has completed even if there was no 246258945Srobertooutput. 247258945Sroberto.It Fl f Ar file 248258945SrobertoRead the job from 249258945Sroberto.Ar file 250258945Srobertorather than standard input. 251280849Scy.It Fl l 252258945SrobertoWith no arguments, list all jobs for the invoking user. 253258945SrobertoIf one or more 254258945Srobertojob numbers are given, list only those jobs. 255258945Sroberto.It Fl d 256258945SrobertoIs an alias for 257258945Sroberto.Nm atrm 258258945Sroberto(this option is deprecated; use 259258945Sroberto.Fl r 260258945Srobertoinstead). 261258945Sroberto.It Fl b 262258945SrobertoIs an alias for 263258945Sroberto.Nm batch . 264258945Sroberto.It Fl v 265258945SrobertoFor 266258945Sroberto.Nm atq , 267258945Srobertoshows completed but not yet deleted jobs in the queue; otherwise 268258945Srobertoshows the time the job will be executed. 269258945Sroberto.It Fl c 270258945SrobertoCat the jobs listed on the command line to standard output. 271258945Sroberto.It Fl r 272258945SrobertoRemove the specified jobs. 273258945Sroberto.It Fl t 274258945SrobertoSpecify the job time using the \*[Px] time format. 275258945SrobertoThe argument should be in the form 276258945Sroberto.Sm off 277258945Sroberto.Op Oo Ar CC Oc Ar YY 278258945Sroberto.Ar MM DD hh mm Op . Ar SS 279258945Sroberto.Sm on 280258945Srobertowhere each pair of letters represents the following: 281258945Sroberto.Pp 282258945Sroberto.Bl -tag -width indent -compact -offset indent 283258945Sroberto.It Ar CC 284258945SrobertoThe first two digits of the year (the century). 285258945Sroberto.It Ar YY 286258945SrobertoThe second two digits of the year. 287258945Sroberto.It Ar MM 288258945SrobertoThe month of the year, from 1 to 12. 289258945Sroberto.It Ar DD 290258945Srobertothe day of the month, from 1 to 31. 291258945Sroberto.It Ar hh 292258945SrobertoThe hour of the day, from 0 to 23. 293258945Sroberto.It Ar mm 294258945SrobertoThe minute of the hour, from 0 to 59. 295258945Sroberto.It Ar SS 296258945SrobertoThe second of the minute, from 0 to 60. 297258945Sroberto.El 298258945Sroberto.Pp 299258945SrobertoIf the 300258945Sroberto.Ar CC 301258945Srobertoand 302258945Sroberto.Ar YY 303258945Srobertoletter pairs are not specified, the values default to the current 304258945Srobertoyear. 305280849ScyIf the 306280849Scy.Ar SS 307258945Srobertoletter pair is not specified, the value defaults to 0. 308258945Sroberto.El 309258945Sroberto.Sh FILES 310280849Scy.Bl -tag -width _ATJOB_DIR/_LOCKFILE -compact 311258945Sroberto.It Pa _ATJOB_DIR 312258945Srobertodirectory containing job files 313258945Sroberto.It Pa _ATSPOOL_DIR 314258945Srobertodirectory containing output spool files 315258945Sroberto.It Pa /var/run/utx.active 316280849Scylogin records 317258945Sroberto.It Pa _PERM_PATH/at.allow 318258945Srobertoallow permission control 319258945Sroberto.It Pa _PERM_PATH/at.deny 320258945Srobertodeny permission control 321258945Sroberto.It Pa _ATJOB_DIR/_LOCKFILE 322258945Srobertojob-creation lock file 323258945Sroberto.El 324258945Sroberto.Sh EXAMPLES 325258945SrobertoTo run a job at 4pm three days from now, use: 326258945Sroberto.Bd -literal -offset indent 327258945Srobertoat 4pm + 3 days 328258945Sroberto.Ed 329258945Sroberto.Pp 330258945SrobertoTo run a job at 10:00am on July 31, use: 331258945Sroberto.Bd -literal -offset indent 332258945Srobertoat 10am Jul 31 333258945Sroberto.Ed 334258945Sroberto.Pp 335258945SrobertoTo run a job at 1am tomorrow, use: 336258945Sroberto.Bd -literal -offset indent 337258945Srobertoat 1am tomorrow 338258945Sroberto.Ed 339258945Sroberto.Pp 340258945Sroberto.Sh SEE ALSO 341258945Sroberto.Xr nice 1 , 342258945Sroberto.Xr sh 1 , 343258945Sroberto.Xr umask 2 , 344258945Sroberto.Xr atrun 8 , 345258945Sroberto.Xr cron 8 , 346258945Sroberto.Xr sendmail 8 347258945Sroberto.Sh AUTHORS 348258945Sroberto.An -nosplit 349258945SrobertoAt was mostly written by 350258945Sroberto.An Thomas Koenig Aq Mt ig25@rz.uni-karlsruhe.de . 351258945SrobertoThe time parsing routines are by 352258945Sroberto.An David Parsons Aq Mt orc@pell.chi.il.us , 353258945Srobertowith minor enhancements by 354258945Sroberto.An Joe Halpin Aq Mt joe.halpin@attbi.com . 355258945Sroberto.Sh BUGS 356258945SrobertoIf the file 357258945Sroberto.Pa /var/run/utx.active 358258945Srobertois not available or corrupted, or if the user is not logged on at the 359258945Srobertotime 360258945Sroberto.Nm 361258945Srobertois invoked, the mail is sent to the userid found 362258945Srobertoin the environment variable 363258945Sroberto.Ev LOGNAME . 364258945SrobertoIf that is undefined or empty, the current userid is assumed. 365258945Sroberto.Pp 366258945SrobertoThe 367258945Sroberto.Nm at 368258945Srobertoand 369258945Sroberto.Nm batch 370258945Srobertoutilities 371258945Srobertoas presently implemented are not suitable when users are competing for 372258945Srobertoresources. 373258945SrobertoIf this is the case, another batch system such as 374258945Sroberto.Em nqs 375258945Srobertomay be more suitable. 376258945Sroberto.Pp 377258945SrobertoSpecifying a date past 2038 may not work on some systems. 378258945Sroberto