Skip to content
Jun 17 / markg85

Auto resuming is possible in Linux!

Hi,

It “seems” like a windows task not “possible” on linux but that’s wrong. Auto suspending can be done through con jobs as is a widely known.

Auto resuming is something that is in a bit darker area of Linux.
This is how you can do that. There is a linux command line tool (probably even installed by default) called: rtcwake. With this tool you can use your system “Real Time Clock (RTC)” and that allows you to wake your pc at a set point in time.

The commands to do that are very simple but hard to find out if you don’t know what to look for. For example the following commands set your PC to wake in 5 minutes (asuming it’s sleeping) — execute as root! — :

echo 0 >/sys/class/rtc/rtc0/wakealarm # Clear RTC
date “+%s” -d “+ 5 minutes” >/sys/class/rtc/rtc0/wakealarm # Set the time 5 minutes in the future

The latter command can also be done like this:

echo +300 >/sys/class/rtc/rtc0/wakealarm

Now all you have to do is suspend your pc and it will (probably) wake up at the set time.
On the command line there are various ways to suspend:

echo -n mem > /sys/power/state

or

pm-suspend

or other ways (like dbus).

Where is this usefull? Well, this might be very handy for HTPC setups that you can just turn off at times when not a single person is gonna use it.

Hope you found this usefull.
Regards,
Mark.

Leave a Comment