From: Mike Kazantsev <mike_kazantsev@fraggod.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Bash and ACPI issue - laptop lid
Date: Thu, 12 Mar 2009 05:42:50 +0500 [thread overview]
Message-ID: <20090312054250.25aca3d3@coercion> (raw)
In-Reply-To: <49B83E34.6070108@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]
On Wed, 11 Mar 2009 18:41:56 -0400
Saphirus Sage <saphirus497@gmail.com> wrote:
> The issue I've run into is that this will cause my laptop to suspend to
> the RAM upon any change in the lid state, irregardless of if it is open
> or closed. I tried to be more specific by utilizing the suffix of the
> event, but it's incremental, which is a bit beyond my abilities. Any
> suggestions to make this suspend only when the lid is closed?
This one seem to be working for me:
#!/bin/sh
if grep closed /proc/acpi/button/lid/LID0/state &>/dev/null
then echo "Lid closed, suspending..."
else echo "Lid is open, doing nothing"
fi
Then, you can just put it to, say, crontab, with a line like this:
*/5 * * * * /path/to/script.sh
...which'll make it run every five minutes, so the laptop will be
suspended within five mins of closing the lid, which should also
prevent accidental closing events.
Of course, you should put your actions to the aforementioned script, if
you want it to do something useful, instead of just experimental echo.
--
Mike Kazantsev // fraggod.net
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2009-03-12 0:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-11 22:41 [gentoo-user] Bash and ACPI issue - laptop lid Saphirus Sage
2009-03-12 0:42 ` Mike Kazantsev [this message]
2009-03-12 1:35 ` Saphirus Sage
2009-03-12 12:13 ` Sebastian Günther
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090312054250.25aca3d3@coercion \
--to=mike_kazantsev@fraggod.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox