There is a neat package in debian/ubuntu repository called molly-guard
.
Its main purpose is to protect a host from accidental shutdown/reboot. I believe every adminstrator typed 'poweroff' command into wrong terminal at least once. Unplanned downtime is such a pain in the arse. It's no big deal if it was your personal router or something but IT IS a big deal if it was a web-frontend of a big corporate project. And the explanation "I accidently typed poweroff
into wrong terminal" for 15 minutes downtime (usual time here in Moscow to call DC's NOCs and make a ticket to press the power button on the host) of very important project is just unacceptable. So it's better to be prepared for such things.
The package consists of bunch of shell scripts (poweroff
, halt
, reboot
, shutdown
) deployed in /usr/sbin
. When you type, for example, a halt
command, molly-guard
's wrapper will run instead of your original halt
binary, because it's located in /usr/sbin
directory which is before /sbin
in your $PATH
environment.
So here's a little request to any debian/ubuntu administrator out there: type apt-get install molly-guard
and have a cute solution for such annoying problem.