Change Power Button Action

From MythTV Official Wiki
Revision as of 01:26, 19 November 2011 by Wagnerrp (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

With the modern linux kernel's ACPI functions the user can map the power button to perform any function they would like.


within /etc/acpi should be a BASH script, '' or similar that is executed when the power button is pressed. To change the action, first backup the file,

# cp

Now open the file in your favorite text editor, you should see a bash script similar to,

# /etc/acpi/
# Initiates a shutdown when the power putton has been
# pressed.

if ps -Af | grep -q '[k]desktop' && test -f /usr/bin/dcop
    dcop --all-sessions --all-users ksmserver ksmserver logout 0 2 0 && exit 0
    /sbin/shutdown -h now "Power button pressed"

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.