Posts List

Run Specific Command Before/After Suspend/Hibernate on Linux

Using bash sript that accept these arguments: suspend = called when system is going to suspend to ram (sleep) freeze = called when system is going to suspend to disk (hibernate) resume = called when system is wake-up from sleep thaw = called when system is wake-up from hibernate Here is an example of mine! root@pcxthinkslack:/home/bowo# cat /etc/pm/sleep.d/pcx.sh #!/bin/bash case $1 in suspend|freeze) #suspending to RAM logger "suspend/freeze in action" ;; resume|thaw) #resume from suspend #set default parameter of mic led that is muted logger "resume/thaw in action" sudo chmod o+w /sys/devices/platform/thinkpad_acpi/leds/tpacpi::micmute/brightness echo 1 > /sys/devices/platform/thinkpad_acpi/leds/tpacpi::micmute/brightness sudo chmod o-w /sys/devices/platform/thinkpad_acpi/leds/tpacpi::micmute/brightness #restore mixer settings alsactl restore ;; *) ;; esac =-=-=-=-=