Skip to content
awein edited this page Oct 9, 2012 · 2 revisions

This guide is partly untested. Please report feedback!


Install required packages

python27 py27-dnspython py27-argparse py27-netifaces py27-ipy avahi-app bash

Get the code

git clone git://github.com/awein/SleepProxyClient.git
cd SleepProxyClient

Install the scripts

cp debian/sleepproxyclient.default /etc/defaults/sleepproxyclient

mkdir -p /usr/share/sleepproxyclient/scripts
cp sleepproxyclient.* /usr/share/sleepproxyclient/scripts
cp checkSleep.sh /usr/share/sleepproxyclient/scripts
cp 00_sleepproxyclient /usr/share/sleepproxyclient/apm_script.sh

Register suspend/resume scripts

  • Alternative 1: Via apmd (/etc/apmd.conf)
...
apm_event SUSPENDREQ {
        exec "/usr/bin/env bash /usr/share/sleepproxyclient/scripts/apmd.sh suspend"
        exec "/etc/rc.suspend apm suspend";
}
...
apm_event NORMRESUME {
        exec "/etc/rc.resume apm suspend";
        exec "/usr/bin/env bash /usr/share/sleepproxyclient/scripts/apmd.sh resume"
}

apm_event STANDBYRESUME {
        exec "/etc/rc.resume apm standby";
        exec "/usr/bin/env bash /usr/share/sleepproxyclient/scripts/apmd.sh resume"
}
...
  • Alternative 2: Via /etc/rc.suspend and /etc/rc.resume
    • /etc/rc.suspend
...
echo $$ 2> /dev/null > /var/run/rc.suspend.pid

#call sleepproxyclient suspend script
/usr/bin/env bash /usr/share/sleepproxyclient/scripts/apmd.sh suspend

...
  • /etc/rc.resume
...

#call sleepproxyclient resume script
/usr/bin/env bash /usr/share/sleepproxyclient/scripts/apmd.sh resume

exit 0

Suspend your system

To trigger the scripts setup earlier apm -z should be used to suspend the system. Note: This step is untested due to my VM-setup does not support any sleep states

Setup your auto-sleep script

See the documentation on how to setup checkSleep.sh or just use your own solution...

Clone this wiki locally