You are not logged in.

#1 2007-06-26 23:42:57

cry0x
Member
Registered: 2007-04-11
Posts: 91

Custom suspend script

Due to certain bugs with powersaved, I've written my own little suspend script to handle the unloading/loading of modules and daemons and the suspending itself. How do I tell ACPI to run this script when I close the lid, or trigger some other event?


Who is this doin' this synthetic type of alpha beta psychedelic funkin'?

Offline

#2 2007-06-29 20:14:17

retsaw
Member
From: London, UK
Registered: 2005-03-22
Posts: 132

Re: Custom suspend script

Create a file in /etc/acpi/events/ or edit /etc/acpi.handler.sh putting it in there.  As an example I edited the /etc/acpi.handler.sh script to this setting my custom suspend script to run when I press the power button (because it is for a desktop and that is the only ACPI button I have available)

#!/bin/sh
# Default acpi script that takes an entry for all actions

# NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
#       modify it to not use /sys

minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"

set $*

case "$1" in
        button/power)
                #echo "PowerButton pressed!">/dev/tty5
                case "$2" in
                        PWRF) /usr/local/bin/suspend ;;
#                       PWRF)   logger "PowerButton pressed: $2" ;;
                        *)    logger "ACPI action undefined: $2" ;;
                esac
                ;;

I only posted the first part of the file to save space the rest was unmodified.

Offline

#3 2007-06-30 03:24:47

cry0x
Member
Registered: 2007-04-11
Posts: 91

Re: Custom suspend script

Fantastic, works like a charm smile


Who is this doin' this synthetic type of alpha beta psychedelic funkin'?

Offline

Board footer

Powered by FluxBB