Save power: sleep your Ubuntu home server

I don’t need my server on while I’m sleeping. Turns out Ubuntu servers love to sleep, too.

The first hurdle was nontechnical. I had to decide that I was ok not being on IRC while asleep. Once I made this decision, I realized it was the right decision anyway.

The next hurdle was scheduled late-night backups. They’re important. What if the server is powered down when a job is scheduled to run? Anacron to the rescue! When you install it on Ubuntu it transparently takes over daily, monthly, and weekly cron jobs. I installed anacron with

sudo apt-get install anacron

Now, to install a new daily backup job managed by anacron, the easiest thing to do is just add an executable script to /etc/cron.daily.

I also have a bunch of @daily stuff in my personal crontab. There are a couple more steps to get it working as a non-root user, but it’s doable.

To actually put the computer to sleep I use

sudo pm-suspend

over an SSH connection (since the server is normally headless). The first time I tried this the box just froze, but I haven’t been able to repro that since I unplugged the VGA monitor and created swap space. Not sure which of those changes, if either, allowed suspend to work.

I’d also like to resume the box with wakeonlan, but it doesn’t work. Both machines are on the same switch, but the BIOS or ethernet card may not support wake-on-lan.

Published by


I like Free Software.

2 thoughts on “Save power: sleep your Ubuntu home server”

  1. Adam

    One of my many half started tasks* is to experiment with automatic power-on through the BIOS, and you have just prompted me to give it a try.

    apt-get install nvram-wakeup

    Web page here:

    I manage a server at a remote site that exists only to receive backups in the early hours of the morning so, like you, shutting it down when not needed seems like a Good Idea™.

    This leaves the small problem of maintenance: I’d need to temporarily override the shutdown when the backup is complete or, easier, get the owner to reboot it so I can log on for maintenance, as I don’t want to have to do it at 0-dark-hundred.

    I have another system, located on New Zealand’s West Island, that is frequently shut down over night, so I use a cron job with the time set to “@reboot” to run jobs that may have been missed.


    * A friend once responded to my statement that I had lots of half-finished jobs with “No, you have lots of half-started jobs.”


Comments are closed.