[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched

Dmitri Stepanov dstep at mail.ru
Wed Jul 13 08:17:24 UTC 2016


Hi

   I need to shutdown a number of hosts which has not NUT from one which has it.

   I tried to do it from upssched script (after upssched's timer) like this:

case $1 in
        earlyshutdown)
                logger -t upssched-cmd "Early shutdown is started"
                /bin/sh /usr/local/sbin/shutdown-all-hosts.sh
                /usr/local/sbin/upsmon -c fsd
                ;;
esac

   shutdown-all-hosts.sh contains:
# Linux hosts
HOSTLIST="sim iogate br"
for host in $HOSTLIST
do
...
     ssh $host halt -p
...
done
# Windows hosts
ssh shut at com "shutdown -s -t 0"

   shutdown-all-hosts.sh works fine if it runned manually.
   But it does not work even if I insert sleep 30 sec before upsmon -c fsd
   Also I read somewhere that it is not a good idea to shutdown other hosts from the CMDSCRIPT.

   Does anyone know how to shutdown hosts without NUT from a host with NUT?

Thanks in advance
Dmitri Stepanov


More information about the Nut-upsuser mailing list