1*cd056e3cSMateusz Piotrowski.Dd September 18, 2023 2b89321a5SAndrey A. Chernov.Dt "AT" 1 362500372SRuslan Ermilov.Os 4b89321a5SAndrey A. Chernov.Sh NAME 5b541ae06SMike Pritchard.Nm at , 6b541ae06SMike Pritchard.Nm batch , 7b541ae06SMike Pritchard.Nm atq , 8b541ae06SMike Pritchard.Nm atrm 9b89321a5SAndrey A. Chernov.Nd queue, examine or delete jobs for later execution 10b89321a5SAndrey A. Chernov.Sh SYNOPSIS 11b89321a5SAndrey A. Chernov.Nm at 12b89321a5SAndrey A. Chernov.Op Fl q Ar queue 13b89321a5SAndrey A. Chernov.Op Fl f Ar file 14b89321a5SAndrey A. Chernov.Op Fl mldbv 15b89321a5SAndrey A. Chernov.Ar time 16ddcf8022SAndrey A. Chernov.Nm at 17d81986deSMike Barcroft.Op Fl q Ar queue 18d81986deSMike Barcroft.Op Fl f Ar file 19d81986deSMike Barcroft.Op Fl mldbv 204af011c3SRuslan Ermilov.Fl t 214af011c3SRuslan Ermilov.Sm off 224af011c3SRuslan Ermilov.Op Oo Ar CC Oc Ar YY 234af011c3SRuslan Ermilov.Ar MM DD hh mm Op . Ar SS 244af011c3SRuslan Ermilov.Sm on 25d81986deSMike Barcroft.Nm at 26ddcf8022SAndrey A. Chernov.Fl c Ar job Op Ar job ... 27d81986deSMike Barcroft.Nm at 28dfd339a0STim J. Robbins.Fl l Op Ar job ... 29dfd339a0STim J. Robbins.Nm at 30dfd339a0STim J. Robbins.Fl l 31dfd339a0STim J. Robbins.Fl q Ar queue 32dfd339a0STim J. Robbins.Nm at 33d81986deSMike Barcroft.Fl r Ar job Op Ar job ... 34ddcf8022SAndrey A. Chernov.Pp 35b89321a5SAndrey A. Chernov.Nm atq 36b89321a5SAndrey A. Chernov.Op Fl q Ar queue 37b89321a5SAndrey A. Chernov.Op Fl v 38b89321a5SAndrey A. Chernov.Pp 39b89321a5SAndrey A. Chernov.Nm atrm 40b89321a5SAndrey A. Chernov.Ar job 41b89321a5SAndrey A. Chernov.Op Ar job ... 42b89321a5SAndrey A. Chernov.Pp 43b89321a5SAndrey A. Chernov.Nm batch 44b89321a5SAndrey A. Chernov.Op Fl q Ar queue 45b89321a5SAndrey A. Chernov.Op Fl f Ar file 46b89321a5SAndrey A. Chernov.Op Fl mv 47b89321a5SAndrey A. Chernov.Op Ar time 48b89321a5SAndrey A. Chernov.Sh DESCRIPTION 499d5eb445SGiorgos KeramidasThe 509d5eb445SGiorgos Keramidas.Nm at 51b89321a5SAndrey A. Chernovand 52b89321a5SAndrey A. Chernov.Nm batch 539d5eb445SGiorgos Keramidasutilities 54b89321a5SAndrey A. Chernovread commands from standard input or a specified file which are to 55b89321a5SAndrey A. Chernovbe executed at a later time, using 56b89321a5SAndrey A. Chernov.Xr sh 1 . 57b89321a5SAndrey A. Chernov.Bl -tag -width indent 58b89321a5SAndrey A. Chernov.It Nm at 59b89321a5SAndrey A. Chernovexecutes commands at a specified time; 60b89321a5SAndrey A. Chernov.It Nm atq 61b89321a5SAndrey A. Chernovlists the user's pending jobs, unless the user is the superuser; in that 62b89321a5SAndrey A. Chernovcase, everybody's jobs are listed; 63b89321a5SAndrey A. Chernov.It Nm atrm 64b89321a5SAndrey A. Chernovdeletes jobs; 65b89321a5SAndrey A. Chernov.It Nm batch 66bb50c318SAlexander Leidingerexecutes commands when system load levels permit; in other words, when 67bb50c318SAlexander Leidingerthe load average drops below _LOADAVG_MX times number of active CPUs, 68bb50c318SAlexander Leidingeror the value specified in the invocation of 69b89321a5SAndrey A. Chernov.Nm atrun . 70b89321a5SAndrey A. Chernov.El 71b89321a5SAndrey A. Chernov.Pp 729d5eb445SGiorgos KeramidasThe 739d5eb445SGiorgos Keramidas.Nm at 749d5eb445SGiorgos Keramidasutility allows some moderately complex 75b89321a5SAndrey A. Chernov.Ar time 76ec2eb6a2SRuslan Ermilovspecifications. 77ec2eb6a2SRuslan ErmilovIt accepts times of the form 78b89321a5SAndrey A. Chernov.Ar HHMM 79b89321a5SAndrey A. Chernovor 80b89321a5SAndrey A. Chernov.Ar HH:MM 81b89321a5SAndrey A. Chernovto run a job at a specific time of day. 82b89321a5SAndrey A. Chernov(If that time is already past, the next day is assumed.) 83e1bc822eSMike BarcroftAs an alternative, the following keywords may be specified: 84d13b8b3eSMateusz Piotrowski.Cm midnight , 85d13b8b3eSMateusz Piotrowski.Cm noon , 86b89321a5SAndrey A. Chernovor 87d13b8b3eSMateusz Piotrowski.Cm teatime 88b89321a5SAndrey A. Chernov(4pm) 89e1bc822eSMike Barcroftand time-of-day may be suffixed with 90d13b8b3eSMateusz Piotrowski.Cm AM 91b89321a5SAndrey A. Chernovor 92d13b8b3eSMateusz Piotrowski.Cm PM 93b89321a5SAndrey A. Chernovfor running in the morning or the evening. 94e1bc822eSMike BarcroftThe day on which the job is to be run may also be specified 95b89321a5SAndrey A. Chernovby giving a date in the form 96b89321a5SAndrey A. Chernov.Ar \%month-name day 97b89321a5SAndrey A. Chernovwith an optional 98b89321a5SAndrey A. Chernov.Ar year , 991309232cSGiorgos Keramidasor giving a date of the forms 1001309232cSGiorgos Keramidas.Ar DD.MM.YYYY , 1011309232cSGiorgos Keramidas.Ar DD.MM.YY , 1021309232cSGiorgos Keramidas.Ar MM/DD/YYYY , 1031309232cSGiorgos Keramidas.Ar MM/DD/YY , 104d13b8b3eSMateusz Piotrowski.Ar MMDDYYYY , 105d13b8b3eSMateusz Piotrowskior 1061309232cSGiorgos Keramidas.Ar MMDDYY . 10729eaad36SJoerg WunschThe specification of a date must follow the specification of 10829eaad36SJoerg Wunschthe time of day. 109e1bc822eSMike BarcroftTime can also be specified as: 110d13b8b3eSMateusz Piotrowski.Op Cm now 111d13b8b3eSMateusz Piotrowski.Cm \&+ Ar count \%time-units , 112b89321a5SAndrey A. Chernovwhere the time-units can be 113d13b8b3eSMateusz Piotrowski.Cm minutes , 114d13b8b3eSMateusz Piotrowski.Cm hours , 115d13b8b3eSMateusz Piotrowski.Cm days , 116d13b8b3eSMateusz Piotrowski.Cm weeks , 117d13b8b3eSMateusz Piotrowski.Cm months 118b89321a5SAndrey A. Chernovor 119d13b8b3eSMateusz Piotrowski.Cm years 120e1bc822eSMike Barcroftand 12181c8c7a4SPhilippe Charnier.Nm 122e1bc822eSMike Barcroftmay be told to run the job today by suffixing the time with 123d13b8b3eSMateusz Piotrowski.Cm today 124b89321a5SAndrey A. Chernovand to run the job tomorrow by suffixing the time with 125d13b8b3eSMateusz Piotrowski.Cm tomorrow . 126b89321a5SAndrey A. Chernov.Pp 127d81986deSMike BarcroftThe 128d81986deSMike Barcroft.Nm at 129e27480d6SRuslan Ermilovutility also supports the 130e27480d6SRuslan Ermilov.Tn POSIX 131e27480d6SRuslan Ermilovtime format (see 132d81986deSMike Barcroft.Fl t 133d81986deSMike Barcroftoption). 134d81986deSMike Barcroft.Pp 135b89321a5SAndrey A. ChernovFor both 13681c8c7a4SPhilippe Charnier.Nm 137b89321a5SAndrey A. Chernovand 138b89321a5SAndrey A. Chernov.Nm batch , 139b89321a5SAndrey A. Chernovcommands are read from standard input or the file specified 140b89321a5SAndrey A. Chernovwith the 141b89321a5SAndrey A. Chernov.Fl f 142b89321a5SAndrey A. Chernovoption and executed. 143b89321a5SAndrey A. ChernovThe working directory, the environment (except for the variables 14481c8c7a4SPhilippe Charnier.Ev TERM , 14581c8c7a4SPhilippe Charnier.Ev TERMCAP , 14681c8c7a4SPhilippe Charnier.Ev DISPLAY 147b89321a5SAndrey A. Chernovand 148d13b8b3eSMateusz Piotrowski.Ev _ ) 149b89321a5SAndrey A. Chernovand the 150b89321a5SAndrey A. Chernov.Ar umask 151b89321a5SAndrey A. Chernovare retained from the time of invocation. 152b89321a5SAndrey A. ChernovAn 15381c8c7a4SPhilippe Charnier.Nm 154b89321a5SAndrey A. Chernovor 155b89321a5SAndrey A. Chernov.Nm batch 156b89321a5SAndrey A. Chernovcommand invoked from a 157b89321a5SAndrey A. Chernov.Xr su 1 158b89321a5SAndrey A. Chernovshell will retain the current userid. 159b89321a5SAndrey A. ChernovThe user will be mailed standard error and standard output from his 160ec2eb6a2SRuslan Ermilovcommands, if any. 161ec2eb6a2SRuslan ErmilovMail will be sent using the command 162b89321a5SAndrey A. Chernov.Xr sendmail 8 . 163b89321a5SAndrey A. ChernovIf 16481c8c7a4SPhilippe Charnier.Nm 165b89321a5SAndrey A. Chernovis executed from a 166b89321a5SAndrey A. Chernov.Xr su 1 167b89321a5SAndrey A. Chernovshell, the owner of the login shell will receive the mail. 168b89321a5SAndrey A. Chernov.Pp 169b89321a5SAndrey A. ChernovThe superuser may use these commands in any case. 170f6db21a6SMurray StokelyFor other users, permission to use 171f6db21a6SMurray Stokely.Nm 172f6db21a6SMurray Stokelyis determined by the files 173b89321a5SAndrey A. Chernov.Pa _PERM_PATH/at.allow 174b89321a5SAndrey A. Chernovand 175b89321a5SAndrey A. Chernov.Pa _PERM_PATH/at.deny . 176b89321a5SAndrey A. Chernov.Pp 177b89321a5SAndrey A. ChernovIf the file 178b89321a5SAndrey A. Chernov.Pa _PERM_PATH/at.allow 179b89321a5SAndrey A. Chernovexists, only usernames mentioned in it are allowed to use 180d0353b83SRuslan Ermilov.Nm . 18185785286SGiorgos KeramidasIn these two files, a user is considered to be listed only if the user 18285785286SGiorgos Keramidasname has no blank or other characters before it on its line and a 18385785286SGiorgos Keramidasnewline character immediately after the name, even at the end of 18485785286SGiorgos Keramidasthe file. 18585785286SGiorgos KeramidasOther lines are ignored and may be used for comments. 186b89321a5SAndrey A. Chernov.Pp 187b89321a5SAndrey A. ChernovIf 188b89321a5SAndrey A. Chernov.Pa _PERM_PATH/at.allow 189b89321a5SAndrey A. Chernovdoes not exist, 190b89321a5SAndrey A. Chernov.Pa _PERM_PATH/at.deny 191b89321a5SAndrey A. Chernovis checked, every username not mentioned in it is then allowed 192b89321a5SAndrey A. Chernovto use 193a654c53eSRuslan Ermilov.Nm . 194b89321a5SAndrey A. Chernov.Pp 195b89321a5SAndrey A. ChernovIf neither exists, only the superuser is allowed use of 196a654c53eSRuslan Ermilov.Nm . 197587582a6SJoerg WunschThis is the default configuration. 198cdb88679SJeroen Ruigrok van der Werven.Sh IMPLEMENTATION NOTES 199cdb88679SJeroen Ruigrok van der WervenNote that 200cdb88679SJeroen Ruigrok van der Werven.Nm 201cdb88679SJeroen Ruigrok van der Wervenis implemented through the 202cdb88679SJeroen Ruigrok van der Werven.Xr cron 8 203cdb88679SJeroen Ruigrok van der Wervendaemon by calling 204cdb88679SJeroen Ruigrok van der Werven.Xr atrun 8 205cdb88679SJeroen Ruigrok van der Wervenevery five minutes. 206cdb88679SJeroen Ruigrok van der WervenThis implies that the granularity of 207cdb88679SJeroen Ruigrok van der Werven.Nm 208cdb88679SJeroen Ruigrok van der Wervenmight not be optimal for every deployment. 209f4cf731dSAllan JudeIf a finer granularity is desired, the 210f4cf731dSAllan Jude.Pa /etc/cron.d/at 211f4cf731dSAllan Judefile can be edited and will be read by the system crontab, from which 2124c0fab71SAllan Judethe 2134c0fab71SAllan Jude.Ev SHELL 2144c0fab71SAllan Judeand 2154c0fab71SAllan Jude.Ev PATH 2164c0fab71SAllan Judeenvironment variables are inherited. 217b89321a5SAndrey A. Chernov.Sh OPTIONS 218b89321a5SAndrey A. Chernov.Bl -tag -width indent 219b89321a5SAndrey A. Chernov.It Fl q Ar queue 22081c8c7a4SPhilippe CharnierUse the specified queue. 221b89321a5SAndrey A. ChernovA queue designation consists of a single letter; valid queue designations 222b89321a5SAndrey A. Chernovrange from 22381c8c7a4SPhilippe Charnier.Ar a 224b89321a5SAndrey A. Chernovto 22566f8a9c0SPhilippe Charnier.Ar z 226b89321a5SAndrey A. Chernovand 22781c8c7a4SPhilippe Charnier.Ar A 228b89321a5SAndrey A. Chernovto 22981c8c7a4SPhilippe Charnier.Ar Z . 230b89321a5SAndrey A. ChernovThe 23181c8c7a4SPhilippe Charnier.Ar _DEFAULT_AT_QUEUE 232b89321a5SAndrey A. Chernovqueue is the default for 23381c8c7a4SPhilippe Charnier.Nm 234b89321a5SAndrey A. Chernovand the 23581c8c7a4SPhilippe Charnier.Ar _DEFAULT_BATCH_QUEUE 236b89321a5SAndrey A. Chernovqueue for 237b89321a5SAndrey A. Chernov.Nm batch . 238b89321a5SAndrey A. ChernovQueues with higher letters run with increased niceness. 239b89321a5SAndrey A. ChernovIf a job is submitted to a queue designated with an uppercase letter, it 240b89321a5SAndrey A. Chernovis treated as if it had been submitted to batch at that time. 241b89321a5SAndrey A. ChernovIf 242b89321a5SAndrey A. Chernov.Nm atq 243b89321a5SAndrey A. Chernovis given a specific queue, it will only show jobs pending in that queue. 244b89321a5SAndrey A. Chernov.It Fl m 245b89321a5SAndrey A. ChernovSend mail to the user when the job has completed even if there was no 246b89321a5SAndrey A. Chernovoutput. 247b89321a5SAndrey A. Chernov.It Fl f Ar file 24881c8c7a4SPhilippe CharnierRead the job from 249b89321a5SAndrey A. Chernov.Ar file 250b89321a5SAndrey A. Chernovrather than standard input. 251b89321a5SAndrey A. Chernov.It Fl l 2525ec37969SRuslan ErmilovWith no arguments, list all jobs for the invoking user. 2535ec37969SRuslan ErmilovIf one or more 254dfd339a0STim J. Robbinsjob numbers are given, list only those jobs. 255b89321a5SAndrey A. Chernov.It Fl d 256b89321a5SAndrey A. ChernovIs an alias for 257d81986deSMike Barcroft.Nm atrm 258d81986deSMike Barcroft(this option is deprecated; use 259d81986deSMike Barcroft.Fl r 260d81986deSMike Barcroftinstead). 261b89321a5SAndrey A. Chernov.It Fl b 262b89321a5SAndrey A. ChernovIs an alias for 263b89321a5SAndrey A. Chernov.Nm batch . 264b89321a5SAndrey A. Chernov.It Fl v 265b89321a5SAndrey A. ChernovFor 266b89321a5SAndrey A. Chernov.Nm atq , 267b89321a5SAndrey A. Chernovshows completed but not yet deleted jobs in the queue; otherwise 268b89321a5SAndrey A. Chernovshows the time the job will be executed. 269ddcf8022SAndrey A. Chernov.It Fl c 27081c8c7a4SPhilippe CharnierCat the jobs listed on the command line to standard output. 271d81986deSMike Barcroft.It Fl r 2724af011c3SRuslan ErmilovRemove the specified jobs. 273d81986deSMike Barcroft.It Fl t 2744af011c3SRuslan ErmilovSpecify the job time using the \*[Px] time format. 275d81986deSMike BarcroftThe argument should be in the form 2764af011c3SRuslan Ermilov.Sm off 2774af011c3SRuslan Ermilov.Op Oo Ar CC Oc Ar YY 2784af011c3SRuslan Ermilov.Ar MM DD hh mm Op . Ar SS 2794af011c3SRuslan Ermilov.Sm on 280d81986deSMike Barcroftwhere each pair of letters represents the following: 281d81986deSMike Barcroft.Pp 2824af011c3SRuslan Ermilov.Bl -tag -width indent -compact -offset indent 283d81986deSMike Barcroft.It Ar CC 284d81986deSMike BarcroftThe first two digits of the year (the century). 285d81986deSMike Barcroft.It Ar YY 286d81986deSMike BarcroftThe second two digits of the year. 287d81986deSMike Barcroft.It Ar MM 288d81986deSMike BarcroftThe month of the year, from 1 to 12. 289d81986deSMike Barcroft.It Ar DD 290d81986deSMike Barcroftthe day of the month, from 1 to 31. 291d81986deSMike Barcroft.It Ar hh 292d81986deSMike BarcroftThe hour of the day, from 0 to 23. 293d81986deSMike Barcroft.It Ar mm 294d81986deSMike BarcroftThe minute of the hour, from 0 to 59. 295d81986deSMike Barcroft.It Ar SS 2963181398bSConrad MeyerThe second of the minute, from 0 to 60. 297d81986deSMike Barcroft.El 298d81986deSMike Barcroft.Pp 299d81986deSMike BarcroftIf the 3004af011c3SRuslan Ermilov.Ar CC 301d81986deSMike Barcroftand 3024af011c3SRuslan Ermilov.Ar YY 303d81986deSMike Barcroftletter pairs are not specified, the values default to the current 304d81986deSMike Barcroftyear. 305d81986deSMike BarcroftIf the 3064af011c3SRuslan Ermilov.Ar SS 307d81986deSMike Barcroftletter pair is not specified, the value defaults to 0. 3089b88faecSRuslan Ermilov.El 309b89321a5SAndrey A. Chernov.Sh FILES 310b89321a5SAndrey A. Chernov.Bl -tag -width _ATJOB_DIR/_LOCKFILE -compact 311b89321a5SAndrey A. Chernov.It Pa _ATJOB_DIR 31281c8c7a4SPhilippe Charnierdirectory containing job files 313b89321a5SAndrey A. Chernov.It Pa _ATSPOOL_DIR 31481c8c7a4SPhilippe Charnierdirectory containing output spool files 3150806dd92SEd Schouten.It Pa /var/run/utx.active 31681c8c7a4SPhilippe Charnierlogin records 317b89321a5SAndrey A. Chernov.It Pa _PERM_PATH/at.allow 31881c8c7a4SPhilippe Charnierallow permission control 319b89321a5SAndrey A. Chernov.It Pa _PERM_PATH/at.deny 32081c8c7a4SPhilippe Charnierdeny permission control 321b89321a5SAndrey A. Chernov.It Pa _ATJOB_DIR/_LOCKFILE 32281c8c7a4SPhilippe Charnierjob-creation lock file 323b89321a5SAndrey A. Chernov.El 324*cd056e3cSMateusz Piotrowski.Sh EXAMPLES 325*cd056e3cSMateusz PiotrowskiTo run a job at 4pm three days from now, use: 326*cd056e3cSMateusz Piotrowski.Bd -literal -offset indent 327*cd056e3cSMateusz Piotrowskiat 4pm + 3 days 328*cd056e3cSMateusz Piotrowski.Ed 329*cd056e3cSMateusz Piotrowski.Pp 330*cd056e3cSMateusz PiotrowskiTo run a job at 10:00am on July 31, use: 331*cd056e3cSMateusz Piotrowski.Bd -literal -offset indent 332*cd056e3cSMateusz Piotrowskiat 10am Jul 31 333*cd056e3cSMateusz Piotrowski.Ed 334*cd056e3cSMateusz Piotrowski.Pp 335*cd056e3cSMateusz PiotrowskiTo run a job at 1am tomorrow, use: 336*cd056e3cSMateusz Piotrowski.Bd -literal -offset indent 337*cd056e3cSMateusz Piotrowskiat 1am tomorrow 338*cd056e3cSMateusz Piotrowski.Ed 339*cd056e3cSMateusz Piotrowski.Pp 340a4cab7d3SMike Pritchard.Sh SEE ALSO 341a4cab7d3SMike Pritchard.Xr nice 1 , 342a4cab7d3SMike Pritchard.Xr sh 1 , 343a4cab7d3SMike Pritchard.Xr umask 2 , 344a4cab7d3SMike Pritchard.Xr atrun 8 , 345a4cab7d3SMike Pritchard.Xr cron 8 , 346a4cab7d3SMike Pritchard.Xr sendmail 8 3476c7216dfSRuslan Ermilov.Sh AUTHORS 3482b7af31cSBaptiste Daroussin.An -nosplit 3496c7216dfSRuslan ErmilovAt was mostly written by 3502b7af31cSBaptiste Daroussin.An Thomas Koenig Aq Mt ig25@rz.uni-karlsruhe.de . 3516c7216dfSRuslan ErmilovThe time parsing routines are by 3522b7af31cSBaptiste Daroussin.An David Parsons Aq Mt orc@pell.chi.il.us , 3536c7216dfSRuslan Ermilovwith minor enhancements by 3542b7af31cSBaptiste Daroussin.An Joe Halpin Aq Mt joe.halpin@attbi.com . 355b89321a5SAndrey A. Chernov.Sh BUGS 356b89321a5SAndrey A. ChernovIf the file 3570806dd92SEd Schouten.Pa /var/run/utx.active 358b89321a5SAndrey A. Chernovis not available or corrupted, or if the user is not logged on at the 359b89321a5SAndrey A. Chernovtime 36081c8c7a4SPhilippe Charnier.Nm 361b89321a5SAndrey A. Chernovis invoked, the mail is sent to the userid found 362b89321a5SAndrey A. Chernovin the environment variable 36381c8c7a4SPhilippe Charnier.Ev LOGNAME . 364b89321a5SAndrey A. ChernovIf that is undefined or empty, the current userid is assumed. 365b89321a5SAndrey A. Chernov.Pp 3669d5eb445SGiorgos KeramidasThe 3679d5eb445SGiorgos Keramidas.Nm at 368b89321a5SAndrey A. Chernovand 369b89321a5SAndrey A. Chernov.Nm batch 3709d5eb445SGiorgos Keramidasutilities 371b89321a5SAndrey A. Chernovas presently implemented are not suitable when users are competing for 372b89321a5SAndrey A. Chernovresources. 373e1bc822eSMike BarcroftIf this is the case, another batch system such as 374e1bc822eSMike Barcroft.Em nqs 375e1bc822eSMike Barcroftmay be more suitable. 376d81986deSMike Barcroft.Pp 37700e39e5eSMike BarcroftSpecifying a date past 2038 may not work on some systems. 378