Dmitri Stepanov
2016-Jul-12 09:08 UTC
[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20160712/047e9007/attachment.html>
Dmitri Stepanov
2016-Jul-13 08:17 UTC
[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched
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
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
Stuart Gathman
2016-Jul-13 14:02 UTC
[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched
On 07/13/2016 04:17 AM, Dmitri Stepanov wrote:> I need to shutdown a number of hosts which has not NUT from one which has it.Let's make sure you are not missing an obvious point. By "has not NUT", you might mean not running upsd. The best practice is to run upsmon on the other hosts. This does not require running NUT proper (server). Is there some reason why you can't run upsmon on the other hosts? Typically, upsd and drivers are packaged as something like "nut-server", whereas upsmon is packaged as "nut-client".
Maybe Matching 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