On Wed, 13 Jul 2016, Dmitri Stepanov wrote:

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@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

When you say "it does not work", what are the symptoms? Does shutdown-all-hosts.sh get called?

   Also I read somewhere that it is not a good idea to shutdown other hosts 
from the CMDSCRIPT.

The User Manual chapter 7.2:

<< It’s not a good idea to call your system’s shutdown routine directly from the CMDSCRIPT, since there’s no synchronization with the slave systems hooked to the same UPS. FSD is the master’s way of saying "we’re shutting down now like it or not, so you’d better get ready". >> http://networkupstools.org/docs/user-manual.chunked/ar01s07.html

If you want to shutdown your slave systems siom, iogate and br from the CMDSCRIPT, you will need to reproduce the NUT protocol of "slaves first", then the master. Your current protocol does not check that the slaves are indeed shutting down.

Roger
_______________________________________________
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser

Reply via email to