Re: shutdown/reboot suggestion



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?

Michael Grant

On Sun, Aug 10, 2008 at 3:45 AM, Jeffrey Goldberg <jeffrey@xxxxxxxxxxxx> wrote:
On Aug 9, 2008, at 3:22 PM, Michael Grant wrote:

More than once, through carelessness, and I'm sure I'm not alone, I
have inadvertently shutdown or rebooted the wrong machine. I'm sure
some of you know that all too familiar feeling when you see
"Connection closed" instead of your desktop being rebooted.

I use a combination of tricks.

1. I have the hostname in my prompt.
2. I have a separate color scheme for ssh sessions for each host I commonly
connect to, and a generic color scheme for ssh sessions for other hosts.
These are all distinct from my term window color scheme for my local host.
3. I rarely run as root, so all of my shutdown's use sudo. My password
isn't the same on all hosts.

This doesn't work perfectly, but it does help avoid this kind of problem.


I have a suggestion with respect to these commands. What if they
could be modified to require the hostname of the machine as their
first argument, otherwise, they refuse to bring the machine down?

shutdown -h now

becomes:

shutdown example.com -h now

As others have pointed out, you can easily make scripts to do that.

-j



--
Jeffrey Goldberg http://www.goldmark.org/jeff/


_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Help needed with a js command
    ... The original script allowed to shutdown any computer in the ... computer, and I just need to reboot one computer, anyway. ... Const EWX_SHUTDOWN = 1 ...
    (microsoft.public.scripting.jscript)
  • Re: Script to reboot group of PCs
    ... TRY: Shutdown /? ... /m = specify machine to shutdown ... >> Where machines.txt is a list of machine names or IP's you want to reboot. ... >> Use of any included script samples are subject to the terms specified at ...
    (microsoft.public.windows.server.scripting)
  • Re: script to mail@localhost when system reboots
    ... I have to create a script which sends a mail everyttime the system ... echo "Shutdown" ... echo "Single User" ... echo "Reboot" ...
    (comp.os.linux.misc)
  • Re: script to mail@localhost when system reboots
    ... I have to create a script which sends a mail everyttime the system ... echo "Shutdown" ... echo "Single User" ... echo "Reboot" ...
    (comp.os.linux.misc)
  • Re: Hourly script
    ... but our host has a limit of ... you can use a cron on another *nix box to hit a script ... They moved to a host which didn't allow cron jobs and tried your suggestion. ... As for the reboot. ...
    (comp.lang.php)