Don't understand german? Read or subscribe to my english-only feed.

mika’s advent calendar – day 9: at(1)

One of the tools you probably already have on your system but might not be aware of: at. at(1) reads commands from standard input or a specified file which are to be executed at a later time. Some usage examples (notice: you’ll get the <EOT> by pressing ctrl-d, you know):

Download something at a given time:

% at 02:00
warning: commands will be executed using /bin/sh
at> wget http://debian.netcologne.de/www.grml.org/daily/grml_sid_latest.iso
at> <EOT>
job 11 at Tue Dec 10 02:00:00 2008

Send yourself a mail in 5 minutes:

% at now + 5 minutes
warning: commands will be executed using /bin/sh
at> df -h | mail mika@localhost
at> <EOT>
job 12 at Mon Dec 9 14:47:00 2008

Make sure to catch the pizza:

% echo “DISPLAY=:0 Xdialog –msgbox ‘Time for Pizza’ 0 0” | at now + 10 minutes
warning: commands will be executed using /bin/sh
job 13 at Mon Dec 9 14:52:00 2008

Oh of course: make sure that the at-daemon is running at all (‘/etc/init.d/atd start’). atq lists the pending jobs and atrm allows you to delete jobs. Check out the at(1) manpage for further details.

One Response to “mika’s advent calendar – day 9: at(1)”

  1. peter Says:

    Important to mention: batch. Execute a program when the system load permits it.