Re: shutdown/reboot suggestion
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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: shutdown/reboot suggestion
Michael Grant [EMAIL PROTECTED] 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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
shutdown/reboot suggestion
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 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 and reboot becomes reboot example.com How hard would it to get the other *nix distributions to take up this up too? Michael Grant ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: shutdown/reboot suggestion
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 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 and reboot becomes reboot example.com How hard would it to get the other *nix distributions to take up this up too? Michael Grant ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] Aloha, I have set all my servers in the noc to shutdown -r now. This prevents me from locking my self out of servers as they are not in my office. I also set the tcsh command line to show path to the directory and the name of the host box i'm working on so I cant get confused. Maybe this will help. ~Al Plant - Honolulu, Hawaii - Phone: 808-284-2740 + http://hawaiidakine.com + http://freebsdinfo.org + + http://aloha50.net - Supporting - FreeBSD 6.* - 7.* - 8.* + email: [EMAIL PROTECTED] All that's really worth doing is what we do for others.- Lewis Carrol ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: shutdown/reboot suggestion
Michael Grant [EMAIL PROTECTED] 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 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? Write two scripts that check for those additional arguments and name them 'shutdown' and 'reboot'. Then ensure that they exist earlier in your PATH than the actual shutdown and reboot binaries. -- Sahil Tandon [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: shutdown/reboot suggestion
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 Goldberghttp://www.goldmark.org/jeff/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
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 [EMAIL PROTECTED] 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 Goldberghttp://www.goldmark.org/jeff/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]