Scheduling Jobs in Linux

Hello all,

I was recently needing to schedule the reboot of a print server (Ubuntu), but was unsure how. After looking around a bit, I can do all kinds of things with it. For a simple use case though, here is how to reboot a server with at...

Since we're restarting the server, we need root privileges for that, so we have to run this as sudo this time around. type: sudo at 23:00

You should see... warning: commands will be executed using /bin/sh at>

Type the command you want to occur at 23:00 (11:00 pm). In our case, we're going to restart the server. shutdown -r now Press enter. From here you press ctrl+d and that will save the job for later execution.

The cool thing about at is how intuitive it is. For instance, we just used 23:00 to schedule an e-mail for 11:00 pm. Instead, we could have typed at 11:00 pm. Furthermore, if we wanted to schedule something for tomorrow at 11:00 pm, we could type at 11:00 pm tomorrow. It's a pity for those of us who are forgetful...the "at" utility unfortunately does not understand yesterday.

That's how to do it.

If you want to list all of the jobs for your user, use the command atq. If you need to remove a job, use the atrm command (this uses job numbers from the list atq produces).

Happy scheduling.

... Really, be happy. At least you don't have to be there at 3:00 am to reboot the server.

sudo at 3:00 am a> shutdown -r now ...later at 11:30 pm echo 'ZZZZzzzzzzzzzz...'
 * ctrl+d*