ubuntu shutdown and wakeup timer
Posted in Uncategorized on January 3rd, 2010 by ph-lee – Be the first to commentGoing green
My all-in-one kubuntu media centre and general server sits unused most of the time. So why not set it to switch on and off in sync with when I need it based on the time of day. Should save on some bills.
Requirements
- ACPI
- Linux
Method
Setup a cron job as root to shutdown at the specified time. To edit crons as root enter the following.
sudo crontab -u root -e
Add the following line to the list. This will shut down the box everyday at 0400. Of course you can modify as needed to suit your needs. And if you want to hibernate I’m sure theres a hibernate command.
0 4 * * * /sbin/shutdown -h now
While we’re at it we’ll also set up the wakeup time using rtcwake. So also add the following to the cron list.
45 3 * * * /usr/sbin/rtcwake -m no -s 29700
15 minutes before the shutdown we set the box to wake up in 29700 seconds which equates to 8 hours and 15 minutes. So the machine is scheduled to wake up at 12 noon.
Setup
This solution might be setup dependent so here are some specs that may help…
- Linux kubuntu 9.10 Karmic Koala
- 2.6.31-16-generic #53-Ubuntu SMP Tue Dec 8 04:01:29 UTC 2009 i686 GNU/Linux
- Motherboard: ASUS A7V-133 ACPI BIOS Revision 1007 (10/03/2001)
Making media centres’ greener.