Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Aug 2008 10:09:44 +0200
From:      Jonathan McKeown <jonathan+freebsd-questions@hst.org.za>
To:        freebsd-questions@freebsd.org
Subject:   Re: shutdown/reboot suggestion
Message-ID:  <200808111009.44648.jonathan%2Bfreebsd-questions@hst.org.za>
In-Reply-To: <62b856460808092211r50111d3fnd70feeb46f819a43@mail.gmail.com>
References:  <62b856460808091322m38558ec2o1359fff91ae68a79@mail.gmail.com> <34556D79-74F5-4222-A945-DC22628CB17D@goldmark.org> <62b856460808092211r50111d3fnd70feeb46f819a43@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808111009.44648.jonathan%2Bfreebsd-questions>