Custom inittab

Place to discuss Slackware
Post Reply
worker201
guru
guru
Posts: 668
Joined: Sun Jun 13, 2004 6:38 pm
Location: Hawaii

Custom inittab

Post by worker201 » Tue Feb 06, 2007 5:40 pm

I was looking around at the /etc/inittab file. There's a line in there which tells the system what to do when ctrl-alt-del is pressed. I don't have the specific Slackware syntax on hand, but the sample from the inittab(5) web man page looks pretty similar:

Code: Select all

# What to do at the "3 finger salute".
ca::ctrlaltdel:/sbin/shutdown -t5 -rf now
The default behavior for Slackware is to reboot on ctrl-alt-del. But I modified it, for kicks, to shutdown instead. I think it would be cool to have one keystroke for halt and one for shutdown. Maybe ctrl-alt-ins for one and ctrl-alt-del for the other.

So the question is: how is that done? How do I present the keystrokes?

Code: Select all

ca::ctrlaltins:/sbin/shutdown -t5 -rf now
Is this sufficient? I suppose I could just try it, but I wanted to make sure.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Feb 06, 2007 6:35 pm

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

Post Reply