There are some cases that you need a Linux box to never halt—never ever. Even if you specifically request it…
To protect yourself from yourself one could do the following:
cd /sbin/
mv halt halt.real
chmod 000 halt.real
ln -s reboot halt
mv poweroff poweroff.real
chmod 000 poweroff.real
ln -s reboot poweroff
It would also be wise to modify /etc/init.d/halt. Find the following section:
# See how we were called.
case "$0" in
*halt)
message=$"Halting system..."
command="/sbin/halt"
;;
and turn it into
# See how we were called.
case "$0" in
*halt)
echo $"$0: this system may not be halted!"
exit 1
message=$"Halting system..."
command="/sbin/halt"
;;
.
Also, you may want to set up an exception in sudoers (always use visudo to edit it). Here’s a simple way of prohibiting users to “sudo shutdown -h now” or “sudo halt“:
Cmnd_Alias HALT = /sbin/shutdown, /sbin/halt
%wheel ALL=(ALL) ALL, !HALT
Should you need to reboot, sudo reboot should suffice.
Warning: If your box is connected directly to a UPS you might want to refrain from messing up with halt.
Related posts:
Which OS I Am
Which iPod to buy: A simplistic quanitifed approach.
Where the College Library is in Error