Roger Price
2016-Jul-13 08:49 UTC
[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched
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 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 fsdWhen 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
Dmitri Stepanov
2016-Jul-13 10:46 UTC
[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched
Thank you for answer Roger>?????, 13 ???? 2016, 11:49 +03:00 ?? Roger Price <roger at rogerprice.org>: > >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 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 > >When you say "it does not work", what are the symptoms? Does >shutdown-all-hosts.sh get called?System has installed far away (in China) and there is bad Internet connection, so I might have ability to connect and check log files in a few day or weeks. Now I know exactly only that NUTed hosts shutdown via NUT as expected and no one host listed in shutdown-all-hosts.sh script don't.> >> ?? 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.htmlIt is not good to shutdown from CMDSCRIPT the master itself. Is it correct?> >If you want to shutdown your slave systems siom, iogate and br from the >CMDSCRIPT, you will need to of "slaves first", >then the master. Your current protocol does not check that the slaves are >indeed shutting down.Roger, I would appreciate if you give me a hint how to "reproduce the NUT protocol ... ". Do you mean getting feedback to CMDSCRIPT about the "no NUTed" slaves indeed shutting down and/or some timing in NUT config files...?> >Roger >_______________________________________________ >Nut-upsuser mailing list >Nut-upsuser at lists.alioth.debian.org >http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Roger Price
2016-Jul-13 12:22 UTC
[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched
On Wed, 13 Jul 2016, Dmitri Stepanov wrote:>>> ?? shutdown-all-hosts.sh contains: >>> # Linux hosts >>> HOSTLIST="sim iogate br" >>> for host in $HOSTLIST >>> do >>> ... >>> ???? ssh $host halt -p >>> ... >>> done>>> ?? 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?> System has installed far away (in China) and there is bad Internet > connection, so I might have ability to connect and check log files in a > few day or weeks. Now I know exactly only that NUTed hosts shutdown via > NUT as expected and no one host listed in shutdown-all-hosts.sh script > don't.> Roger, I would appreciate if you give me a hint how to "reproduce the > NUT protocol ... ". Do you mean getting feedback to CMDSCRIPT about the > "no NUTed" slaves indeed shutting down and/or some timing in NUT config > files...?Without knowing the details of your system architecture, it looks as if your system is very different from the typical case for which NUT is intended. I'm assuming that your with-NUT machine is far away from the "slaves" with an unreliable connection. In this case the "slaves" will have to be autonomous and decide for themselves if and when they shut down. I notice that you set up the SSH connection only when you want to remotely order a slave shutdown. Perhaps in your case it would be better to have the ssh link open all the time with a periodic "heartbeat" between the no-NUT slaves and the master-with-NUT. In other words, sim, iogate and br behave as masters, not slaves.> It is not good to shutdown from CMDSCRIPT the master itself. Is it correct?If the no-NUT machines were autonomous, then NUT is in charge of just the with-NUT machine, and there is no problem with shutting down from the CMDSCRIPT. Could you build a local version of your setup for testing? Roger
Reasonably Related Threads
- Best practice to shutdown hosts which has not NUT via upssched
- Best practice to shutdown hosts which has not NUT via upssched
- Best practice to shutdown hosts which has not NUT via upssched
- Best practice to shutdown hosts which has not NUT via upssched
- Best practice to shutdown hosts which has not NUT via upssched