BXG Blog

ACPI Wakeup to the Rescue

My old Dell had a BIOS option to automatically turn itself on at a specified time every day.  Combined with a nightly cron job to shut the computer down after its backups had finished, this let me have an “always on” computer (in the sense that it is on whenever I am normally at home) with about 1/3 of the power use of actually leaving the computer on all the time.

When I bought my new HP recently, there was no similar BIOS option.  In fact, I didn’t find any power-related options at all.  As a workaround, I considered buying a physical power-off timer.  This would have gotten the job done, but it seems awfully heavy-handed.  Even worse, the good power switches are expensive and the inexpensive ones are quite primitive.

My solution up to this point was to turn on the computer when I remembered, and let my cron job turn it back off at night.  It wasn’t terribly convenient, but on the bright side, I was saving even more power than before.

Enter Linux: Today I read about ACPI Wakeup on the MythTV site.  It turns out that modern ACPI BIOSes can often set a wakeup time directly in software, and Linux includes everything needed to drive such a BIOS.  The process is very simple to set up.  On Fedora 13, here are the steps:

  1. Set the BIOS to UTC time, if it wasn’t already set up that way.
  2. Edit /etc/init.d/halt and comment out the line that runs /sbin/hwclock.
  3. Adjust my cron job to set the wakeup timer at shutdown each night with
    date +%s -d "17:10" > /sys/class/rtc/rtc0/wakealarm
    

And that’s it. My HP is now just as convenient as the previous Dell.  In fact, since the wakeup time is under the control of Linux instead of the simple BIOS interface, I can get fancy and set up a more complicated schedule later.