Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Aug 2008 08:25:30 -0400
From:      Bill Moran <wmoran@potentialtech.com>
To:        "Michael Grant" <mgrant@grant.org>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: shutdown/reboot suggestion
Message-ID:  <20080811082530.e4c51dae.wmoran@potentialtech.com>
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
"Michael Grant" <mgrant@grant.org> 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?
> 
> This could certainly be the basis for another thread (and this is
> perhaps not the correct list), but is there some way to request a
> modification across all the unix/linux distributions out there to
> maintain some level of consistency across them?  Except for Posix, is
> there some overall list which deals with this conformity of all these
> sibling platforms?

Changing that command globally is a huge undertaking.  First off, it
will break every single script out there that uses those commands, thus
causing a worldwide riot.

Second, it's not compliant with POSIX, thus we reopen the wound of The
Unix Wars.

Third, it's not a very good solution.  Off the top of my head:
1) What happens to machines that don't have a hostname yet?  (during
   install for example) you can't shut them down?
2) Which hostname?  The FQDN, which can be REALLY long in many cases.
   Or the short name, which can be duplicated (how many web00s do I
   have in various facilities across the country?) so then doesn't solve
   the problem.
3) I'm not having the problem you describe, thus you're asking me to
   type more (possibly a LOT more) to solve a problem I don't have.
4) It breaks every single script out there that uses those commands
5) Tied in with #3, there's a REALLY easy way to fix this for those
   out there who are having trouble with it.

I'm unclear why you find the mechanisms built into the system that allow
you to fix this yourself to be inadequate?

-- 
Bill Moran
http://www.potentialtech.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080811082530.e4c51dae.wmoran>