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
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
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.