On 01/16/05 12:29, [EMAIL PROTECTED] wrote:
I have made the following expierience with frozen X:

*) Even if normal keyboard doesn't work, the Magic SysRq often stil does and allows for a "clean" reboot by holding AltGr and pressing k then s then u then b -- Kill all processes, Sync all drives, Umount all drives, Boot the system.

*) the ACPI system can be used to do whatever you want in that case.
I have set it up that when I press the power button once, it does a killall chvt , twice does attempt to kill X and a third time does a reboot.


This is the script I use for that:
/etc/acpi/power.sh:

#!/bin/sh
logger "ACPID: power button pressed!"

if [ -e /tmp/power1 ] ; then
    if [ -e /tmp/power2 ] ; then
        beep -n -n
        logger "ACPID: This is the third press."
        shutdown -fh now
    else
        beep -n
        logger "ACPID: This is the second press."
        touch /tmp/power2
        killall -9 X
    fi
else
    beep
    logger "ACPID: This is the first press."
    touch /tmp/power1
    chvt 1
fi
exit 0

(note that the script could be improved by using "case", but this is probably more shell agnostic, which is a Good Thing) As you can see, over ACPI button events you can do almost everything you want, very cool.

HTH,
    Peter G. a.k.a. nephros

 -- "I do not think the way you think I think."
    -- Kai, last of the Brunnen G

Err... "AltGr"?

--
[email protected] mailing list



Reply via email to