Difference between revisions of "Change Power Button Action"
From MythTV Official Wiki
Steveadeff (talk | contribs) m |
m |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | ' | + | With the modern linux kernel's [[ACPI]] functions the user can map the power button to perform any function they would like. |
− | + | == /etc/acpi == | |
− | |||
− | = /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, | 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, | ||
<pre><nowiki> | <pre><nowiki> | ||
Line 26: | 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: | + | 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. | ||
+ | |||
+ | [[Category:Power Management]] |
Latest revision as of 01:26, 19 November 2011
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.
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.