shutdown/reboot suggestion

Jonathan McKeown jonathan+freebsd-questions at hst.org.za
Mon Aug 11 08:08:51 UTC 2008


On Sunday 10 August 2008 07:11, Michael Grant wrote:
> I have such a script, I put it in /bin/require_hostname and symlinked
> shutdown, halt, reboot, fastboot, and fasthalt to this script:
>
> #!/bin/sh
>
> if [ "$1" = `hostname` ]; then
>         shift
>         exec /sbin/`basename $0` $@
> else
>         echo "For your protection, use: $0 hostname ..."
> fi
>
> I realize a lot of people have their own tricks and habits for
> avoiding such stupidity, but what is the problem of fixing the problem
> globally by getting these commands to take a hostname argument?

The extra typing imposed on every admin in the world? Here's a trick or habit 
for avoiding the ohnosecond (``As your life flashes before your eyes, in the 
unit of time known as an ohnosecond...'' [Usenet, author unknown]):

Pause to check the command before executing. The more dangerous or potentially 
disastrous the command, the longer the pause.

What you're proposing is to enforce the thinking time by making the admin 
pause to type the fully-qualified hostname. Granted, you could change every 
command to enforce thinking time (to take this to the absurd, you could 
arrange that if you hit Enter less than five seconds after another key, the 
shell would give you a ``stop and think'' warning).

It's safer just to develop the habit yourself. I recently saw a colleague take 
an install CD, put it into a machine, and power-cycle the box to start the 
install. I can't think of a technical measure that would have enforced 
thinking time on him. (And yes, it was the wrong box. Five seconds of thought 
would have saved five weeks of work).

Jonathan


More information about the freebsd-questions mailing list