Difference between revisions of "Change Power Button Action"

From MythTV Official Wiki
Jump to: navigation, search
 
Line 24: Line 24:
  
 
From here you can change this BASH script to your liking.
 
From here you can change this BASH script to your liking.
 +
 +
[[Category:HOWTO]]

Revision as of 20:23, 11 January 2006

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

/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.