[ltp] Suspend five minutes after closing lid.

Adam Sloboda linux-thinkpad@linux-thinkpad.org
Sun, 09 Sep 2007 11:49:27 +0200


At Sun, 9 Sep 2007 10:04:49 +0200,
Maciej Musial wrote:
> 
> Hi,
> in /proc/acpi/button/lid/LID/state you've got your lid state
> (open/close). Write a script - it should check the state, sleep for 5
> minutes, check the state again - if still closed run suspend.
> There should be simillar script in /etc/acpi/ (f.e. lid.sh) you can edit it.
> 

And don't forget to kill the script on lid open.

When you run sleep script like this:

 this_is_sleep_and_testing_script.sh & # THIS_IS_MAGIC

you can kill it like this when you open lid:

 kill `ps aux | grep -v grep | awk '/# THIS_IS_MAGIC/ { print $2 }'`

Everything else is work for acpid.

Adam