Change Power Button Action
From MythTV
With the modern linux kernel's ACPI functions the user can map the power button to perform any function they would like.
[edit]
/etc/acpi
within /etc/acpi should be a BASH script, 'powerbtn.sh' or similar that is executed when the power button is pressed. To change the action, first backup the file,
# cp powerbtn.sh powerbtn.sh.bak
Now open the file in your favorite text editor, you should see a bash script similar to,
#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.
if ps -Af | grep -q '[k]desktop' && test -f /usr/bin/dcop
then
dcop --all-sessions --all-users ksmserver ksmserver logout 0 2 0 && exit 0
else
/sbin/shutdown -h now "Power button pressed"
fi
From here you can change this BASH script to your liking.
For example, you might want to replace /sbin/shutdown command with
/usr/bin/mythshutdown -x
Added in 0.21, this will automatically check that there is no recording in progress, set the computer to wake up for the next recording and then shutdown.
