# Emergency shutdown

## TGL

Hi, 

This mornig, XFree freezed my keyboard and mouse, and I had to reboot "à la Windows"... I really don't like this... It would be nice to have another machine, in order to telnet and kill XFree in such situation, but I don't. 

So I wonder if their is a way to make an "emergency shutdown button", connected for example to the serial port, wich would launch a clean "shutdown -t now". I know ACPI demon can handle power button that way, but it doesn't seems to be supported on my hardware. As far as I know, some UPS power protection send such alert on serial port. So, that's it, I would like to make a device. 

Any ideas ?

----------

## TGL

I've something interesting (at least for me): The UPS Howto describes how the serial port alert is send by an UPS and monitored by "powerd". I'll start to hack a small emergency device as soon as I'll have time. (But I will first try to solve my xfree hangs...)

http://www.tldp.org/HOWTO/UPS-HOWTO-5.html

----------

## Sihaya

The sysrq key can be configured to kill processes. Even if Xfree has crashed and locked the keyboard it 'll work.

Read /usr/src/linux/Documentation/sysrq.txt on how to configure it.

----------

## TGL

Sihaya, your tip is great. I really thank you very much for that, I've been using linux for 4 years without seeing it in any book or tip's&tricks doc... 

PS: for those who wonder where this option is hidden, have a look in "kernel hacking" section when you menuconfig.

----------

## JefP@@

sysrq will work, if your crash isn't gfx hardware related ... when my athlon crashes, while running an opengl application, it won't work ...

most of the time it works though  :Wink: 

Grtz

----------

