cancel
Showing results for 
Search instead for 
Did you mean: 

Mutiple system shutdown

Mutiple system shutdown

Hi All ~

Has anyone automated a multiple system shutdown from a central location? I have 25 HP-UX workstations (C180s and C360s). In the event of a power failure, I would like to issue a command that will pass the "shutdown -h now" to all the systems. Sounds fairly simple. I'm thinking of using remsh but I haven't tested it yet. Any suggestions?

Thanks!
Carina
6 REPLIES
Rita C Workman
Honored Contributor

Re: Mutiple system shutdown

In the event of a power outage...I would recommend UPS Monitor/EMS or something similar. That way when the time the power has been down meets certain criteria....it will do the shutdown or if the power restores within that timeframe, it will let the system stay up, as it should.

Just my 2cents,
/rcw
Marcel Boon
Trusted Contributor

Re: Mutiple system shutdown

Hi,

Yes, you could do it with remsh but you can do it only as root or restricted user. So first
check if you have the permissions on all other hosts.
hmm...put your script in the crontab and try it in the evening.

Goodluck.

Marcel
See the man pages
Dave Wherry
Esteemed Contributor

Re: Mutiple system shutdown

As was said earlier, if you have the permissions between systems you can easliy script a bunch of remsh commands and it will work. How do you want to trigger this script? Are you going to run it manually or have it kick in automatically when there is a power failure?
We have an APC UPS with a Web/SNMP Managment Card in it. We installed APC's PowerChute software on our servers. When there is a power failure the Managment card will send out a signal. PowerChute listens for these signals and will then log the information, email a notification, run a script that I have set up or just shut the system down. It's unattended and pretty easy to set up.
The real slick part is your system does not have to be powered by this UPS. you could buy a small unit with the Managment Card. When it detects a power failure it will send the signal to any host you designate. It can just be the trigger for the shut down process.
Bill Hassell
Honored Contributor

Re: Mutiple system shutdown

If a powerfailure is imminent (less than a minute), shutdown is not a reliable way to bring the systems down quickly as it often gets hung waiting on some networking problem. For an emergency shutdown, use reboot -qh.

reboot -qh will halt the system(s) in just a few seconds, pausing just long enough to sync the filesystems. Now the reboot -qh command is not friendly to application programs...it's the same as a kill -9 in that the programs are given no opportunity for cleanup. But given the choice between an uncontrolled loss of power (which can sometimes be worse than kill -9) versus a sync of the disks and clean shutdown, well the choice is pretty clear.


Bill Hassell, sysadmin
Stefan Schulz
Honored Contributor

Re: Mutiple system shutdown

I have a small script which is triggerd by our UPS Software in the case of a powerfailure:

#!/bin/csh
#
# 99-09-08; sts shutdown_server geschrieben um alle Server im Falle
# eines Stromausfalls kontrolliert runter zu fahren.
#
#
#------------------------------------------------------
# Varaiblen vorbelegen
#------------------------------------------------------
set com = $0
set Workstations = ()
#
#------------------------------------------------------
# pruefen der Aufrufparameter
#------------------------------------------------------
#
if ($#argv == 0) set argv = "-h"
switch ($1)
#
case -r: # script startet
goto losgehts # zur Shutdownsession gehen
breaksw
case -h:
goto help # zur Hilfe verzweigen
breaksw
default:
echo ""
echo " $com:t --> unbekannte Option >$argv<"
echo ""
help:
echo ""
echo "$com:t :Verwendung : $com:t [-h|-r] -h : druckt diese Meldung -r : startet das script um alle Server herunter zu fahren"
exit 1 # mit status 1 wegen fehlbedienung verlassen
endsw
#
#------------------------------------------------------
# Liste der Server erzeugen, ist leichter zu pflegen
# als mehrer Aufrufe nacheinander
#------------------------------------------------------
#
losgehts:
#
set serverliste = (serv1 serv2 serv3)
#
foreach server ( $serverliste )
remsh $server -n "/usr/sbin/shutdown -h -y 0" > /dev/null & # Server runterfahren
end

exit 0


This is a pretty easy script, but it works.

Hope this helps. Regards Stefan

BTW: How about some points?
No Mouse found. System halted. Press Mousebutton to continue.
Tom Danzig
Honored Contributor

Re: Mutiple system shutdown

Hey Carina ... how's it going? What's wrong with running around and turning off the boxes? ;)