From owner-freebsd-questions@FreeBSD.ORG Mon Aug 11 08:08:50 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E542D1065670 for ; Mon, 11 Aug 2008 08:08:50 +0000 (UTC) (envelope-from jonathan+freebsd-questions@hst.org.za) Received: from hermes.hst.org.za (onix.hst.org.za [209.203.2.133]) by mx1.freebsd.org (Postfix) with ESMTP id ED4988FC28 for ; Mon, 11 Aug 2008 08:08:49 +0000 (UTC) (envelope-from jonathan+freebsd-questions@hst.org.za) Received: from sysadmin.hst.org.za (sysadmin.int.dbn.hst.org.za [10.1.1.20]) (authenticated bits=0) by hermes.hst.org.za (8.13.8/8.13.8) with ESMTP id m7B83vge061644 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Mon, 11 Aug 2008 10:03:58 +0200 (SAST) (envelope-from jonathan+freebsd-questions@hst.org.za) From: Jonathan McKeown Organization: Health Systems Trust To: freebsd-questions@freebsd.org Date: Mon, 11 Aug 2008 10:09:44 +0200 User-Agent: KMail/1.7.2 References: <62b856460808091322m38558ec2o1359fff91ae68a79@mail.gmail.com> <34556D79-74F5-4222-A945-DC22628CB17D@goldmark.org> <62b856460808092211r50111d3fnd70feeb46f819a43@mail.gmail.com> In-Reply-To: <62b856460808092211r50111d3fnd70feeb46f819a43@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808111009.44648.jonathan+freebsd-questions@hst.org.za> X-Spam-Score: -4.376 () ALL_TRUSTED,AWL,BAYES_00 X-Scanned-By: MIMEDefang 2.61 on 209.203.2.133 Subject: Re: shutdown/reboot suggestion X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2008 08:08:51 -0000 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