[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

acpi battery event

Hi Folks.
I just wrote a small script that helps managing automatically acpi battery events. Basically, what this script does, is to analyse the particular event by checking out /proc/acpi/battery/BAT0/state and info and decides what needs to be done. So, if the battery is low and off-line, it sleeps for 60 secs. and then goes to suspend (swsusp2). On the other hand, if the battery is on AC power, it just sends a message. Also, if on AC power, and the hibernation process has started already, it kills it.
I'm sure it's not the most elegant way for doing this, but
it seems to be working on my Compaq Presario 700. Have a look at it, if you find it useful, and let me know if it works.

IMPORTANT: The two scripts are designed to sit in /usr/local/sbin, so change that to suit your taste.

Take care

Attachment: battery.sh
Description: Bourne shell script

#This simple script calls just sleep for 60 secs. and then hibernates the PC.

(/bin/sleep 60; /usr/local/sbin/hibernate)&

Reply to: