I have actually done what you want using ACPI. That's what traps the power button and performs a shutdown. You can trap many buttons with custom ACPI scripts and perform certain actions. It also controls the Sleep and Suspend functions and more. This is completely customizable and you could modify things to do halts or shutdowns. For instance, the power button on my system does a shutdown and the CTRL+ALT+DEL does a shutdown/restart.
For instance, look at your /etc/acpi directory structure.
$ cat /etc/acpi/events/power.conf
- Code: Select all
# ACPID config to power down machine if powerbutton is pressed, but only if
# no gnome-power-manager is running
event=button/power.*
action=/bin/ps awwux | /bin/grep gnome-power-manager | /bin/grep -qv grep || /sb
in/shutdown -h now
See:
$ man
acpi_listen
$ man
acpid
But if you want to do it in inittab I don't think you are going to be able to easily accomplish what you want, at least not without a little kernel and init hacking. It would be interesting to see if you come up with something interesting though.
See:
$ man
ctrlaltdel (I am fairly certain that "/etc/rc.local" is an error and should have been /etc/inittab)
$ man
init
And possibly:
http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-8.html