BuyVM is relocating from San Jose to and I need to shut down my KVM node cleanly before 9pm on Saturday. I could login and do it then but...laziness is a virtue.
I could put it in cron, but I only want it to execute once.
I've noticed everyone knows about cron, but fewer people know about at(1). 'at' is the way to schedule a one-time job.
Example of scheduling a shutdown at 11pm Friday:
# at 11pm friday /sbin/shutdown -h now commands will be executed using /bin/ksh job 1358578800.c at Fri Jan 18 23:00:00 2013 # atq Rank Execution Date Owner Job Queue 1st Jan 18, 2013 23:00 root 1358578800.c c #
Might look a little funky because it's OpenBSD, but the same would work on Linux. Linux will execute the commands using /bin/bash
'atq' is the command to display queued jobs
atrm allows you to remove a job (or at -r in some Unices)
There's also 'batch' which you can find on the at(1) man page - it executes jobs only when the system load level is below a certain threshold.