Shutdown Ubuntu with ctrl-alt-delete

Power cuts are becoming a way of life for many people and here in Blarney we get our fair share of them unfortunately. The second in as many weeks happened this morning and before I could rig up a network cable between my laptop and desktop the UPS powered down and my big noisy desktop died with it. Thankfully without filesystem corruption.

Normally when you press the magic combo of ctrl-alt-delete the machine reboots but in this case it would be much better if the machine did a shutdown. In previous versions of Linux I had to edit /etc/inittab to get the desired effect but that file doesn’t exist in Ubuntu Edgy. Instead you must look at /etc/event.d/control-alt-delete. That file is fairly self explanatory which is all well and good because there’s very little information if you don’t know what to look for.

According to a post here, “Ubuntu replaced init with upstart event daemon”. It’s simple to change it to shutodown. Replace “-r” with “-h” in the following line:
exec /sbin/shutdown/ -r now "Control-Alt-Delete pressed"
No need to run inittab, just hit the magic combo to halt the computer!

PS. thanks so much for all the comments yesterday and the day before. I was bowled over by the response to both posts, especially the Daffodil Day one which struck a chord with many people