I would like to customize the power button action. The tutorial at http://blog.metalight.dk/2010/07/ubuntu-lucid-custom-power-button-event/ works but not always (the number of shutdown processes can sometimes be different).
I need the solution where
- 1x press of a button executes the usual OS shutdown
- 3x press of a button executes OS reboot
How would you write the code for it? FILE: /etc/acpi/powerbtn.sh
#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.
# you need to double 'click' the power button to shutdown
( if ! [ $(pidof -x powerbtn.sh | wc -w) -eq 3 ]; then
sleep .4
exit
else
poweroff
fi
) &