Automatically Resume from Suspend to Ram and Suspend to Disk to Save Battery in Linux

Suspending to RAM is allows the system to quickly wake up. But Suspend to Disk allows the system to completely power off, saving more power. That's why I've written a small script for modern Linux systems, which wakes up the system from S3 (memory sleep) and puts it into S5 (hibernation) mode. Also, it prevents you from losing data, because eventually your system's battery will run out.All you need to do is to put the script into /etc/pm/sleep.d/999_wakeforstr_linuxtipps.blogspot.com and make it executable: chmod +x /etc/pm/sleep.d/999_wakeforstr_linuxtipps.blogspot.com. You can get the current version of my script here:https://dl.dropboxusercontent.com/u/13135314/999_wakeforstr_linuxtipps.blogspot.com

Be aware that it's still at the stage of a proof of concept hack and not necessarily distribution ready. You need a reliably and well working Suspend to Ram and Suspend to Disk mode on your system, as well as a functioning RTC clock for wakeup from sleep. For comfort, I've taught the script to be inactive if that AC is plugged in and to directly hibernate if the battery is below 10 %.

Let me know what your experiences are! If many people like this script, it should be rather easy to include similar functionality into major Linux distributions. If someone could create a distribution package that would be appreciated. Tested on Ubuntu 12.04 with kernel 3.8, but should work on most systems, at least after adjusting the paths.

If you like this post, you can share it, check out the related posts section below and subscribe to one of the RSS feeds so you don't miss the next one.