Monday, May 14, 2012

Scheduling automatic startup (and shutdown) in Ubuntu

I liked the idea of having my Ubuntu machine startup in time for my arrival at the office. Here's how it's done:

1) Enable your RTC in the BIOS, setting your desired wake-up time
2) Use the rtcwake command to tell the machine when to wake up. Two variants of this:

sudo rtcwake -s 54000 -m disk

will wake the PC in 15 hours, after immediately doing a hibernate, or

sudo rtcwake -s 54000 -m no

will do a wake in 15 hours but nothing more. I like this latter way since I can then also schedule a shutdown using a package such as qshutdown

I did toy with nvram-wakeup, which is useful for setting the RTC while you're running Ubuntu.

More here http://askubuntu.com/questions/61708/automatically-sleep-and-wake-up-at-specific-times

And if you get the Grub menu after resuming, the fix is here.