'at' is a quite use shell command on linux.
It can help you to execute a command at some time or some timer later.
We use 'man at', we will get a long helping list, which maybe a litte confusing for the new learner.
Here is the basic usage format of 'at'
1 useage
a. at time -f comman.sh
for example
at 21:03 -f a.sh
job 6 at Mon Sep 19 21:03:00 2011
after your input you will get the prompt, and you can let a.sh be executed at indicated above.
b. at time command
remember , this is an interactive command, which means you need more than more times interactive input for this usage
for example
$ at 21:02 (input enter)
at> touch 2102(input your command and enter)
at> <EOT>(use ctrl+d to quit and save)
job 5 at Sun Sep 18 21:02:00 2011
2 time format
a. hh:mm MMDDYY
which means hour:minute MonthDayYear
for example:
$ at 20:22 112023 -f a.sh
job 10 at Mon Nov 20 20:22:00 2023
and you can use other format
b. now+ timeInterval
for example
$ at now + 2 minute -f a.sh
warning: commands will be executed using /bin/sh
job 11 at Sun Sep 18 21:21:00 2011
of course the timeInterval can be more than "minute" such as hour/day/month/year
what's more, it doesn't if there is a space between '+2minute' or not, which can be '+ 2 minute' or '+2 minute' or '+ 2minute'.
3 other option of at
a. at -l
see all the pending of the current user.
same as 'atq'
b. at -d jobid
delete the job specified by the job id which can be seen with 'at -l'
same as 'atrm'
c. at -c jobid
see the content of the job.
other examples:
at 5pm + 3 days /bin/ls
at 5pm + 2 weeks /bin/ls
at 17:20 tomorrow /bin/date
at 23:59 12/31/1999 echo the end of world !
4 complementarity
format out put of date
"date +%Y%m%h%M"
you will the the fomated string of the date, which will be very useful if you want to create a date named file.