Hi, I am unable to get upssched working correctly as my UPS calls low battery too late and there is no way to change it. I am running Nut 2.7.3 on Ubuntu 14.04 I have made this script, called /sbin/upssched-cmd.sh #!/bin/sh case $1 in onbatt) /sbin/upsmon -c fsd;; *) echo "shutdown implemented";; esac I am trying to run the script manually to break down my issues. All that happens when I run the script is I get the echo script but no shutdown, effectively the script doesn't seem to run the command /sbin/upsmon -c fsd . I have run this command from the command line and the system shuts down as expected.: root at unifi:/sbin# ./upssched-cmd.shshutdown implemented Command run manually works just fine: root at unifi:/# upsmon -c fsdNetwork UPS Tools upsmon 2.7.3 Broadcast Message from nut at unifi (somewhere) at 13:40 ... Executing automatic power-fail shutdown Broadcast Message from nut at unifi (somewhere) at 13:40 ... Auto logout and shutdown proceeding Broadcast message from root at unifi (unknown) at 13:40 ... The system is going down for reboot NOW! Permissions are: root at unifi:/sbin# ls -la upssched-cmd.sh-rwxrwx--- 1 root root 107 Apr 27 13:33 upssched-cmd.sh I have the command pointing at the correct place: unifi at unifi:~$ command -v upsmon/sbin/upsmon Any help appreciated. All I am looking to do is shutdown this master upsd and send shutdown requests to 2 other slaves after 10 mins of the UPS going onto battery. Cheers, James -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20150427/ad115253/attachment.html>
On Mon, 27 Apr 2015, James Hammond wrote:> I am unable to get upssched working correctly as my UPS calls low > battery too late and there is no way to change it. I am running Nut > 2.7.3 on Ubuntu 14.04 I have made this script, called > /sbin/upssched-cmd.sh > > #!/bin/sh > ?case $1 in > ? ?onbatt) > ? ? ?/sbin/upsmon -c fsd;; > ? ?*) > ? ? ?echo "shutdown implemented";; > ?esacHi, Just wondering, do you have a line in upssched.conf which specifies CMDSCRIPT /sbin/upssched-cmd.sh ? Roger
Roger, I did and it didnt work. Hence why I was trying to run just the shell script manually. I am not sure if this works though with the timer defined in it? Cheers, James Date: Mon, 27 Apr 2015 15:03:44 +0200 From: roger at rogerprice.org To: nut-upsuser at lists.alioth.debian.org Subject: Re: [Nut-upsuser] upssched setup On Mon, 27 Apr 2015, James Hammond wrote:> I am unable to get upssched working correctly as my UPS calls low > battery too late and there is no way to change it. I am running Nut > 2.7.3 on Ubuntu 14.04 I have made this script, called > /sbin/upssched-cmd.sh > > #!/bin/sh > case $1 in > onbatt) > /sbin/upsmon -c fsd;; > *) > echo "shutdown implemented";; > esacHi, Just wondering, do you have a line in upssched.conf which specifies CMDSCRIPT /sbin/upssched-cmd.sh ? Roger _______________________________________________ Nut-upsuser mailing list Nut-upsuser at lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20150427/84198d54/attachment.html>
On Mon, Apr 27, 2015 at 3:42 PM, James Hammond <> > > #!/bin/sh > case $1 in > onbatt) > /sbin/upsmon -c fsd;; > *) > echo "shutdown implemented";; > esac > > root at unifi:/sbin# ./upssched-cmd.sh > shutdown implemented > > root at unifi:/# upsmon -c fsd > Network UPS Tools upsmon 2.7.3 > > >I think you should pass $1 parameter to ./upssched-cmd.sh # ./upssched-cmd.sh onbatt The part of case should look like: #!/bin/sh case $1 in onbatt) /sbin/upsmon -c fsd ;; *) echo "shutdown implemented" ;; esac Also from upssched.conf: AT ONBATT * EXECUTE powerout So you need "powerout" instead of "onbatt" in your script. -- Best / ? ?????????? ??????????? *Pavel Potcheptsov* LLC EKTOS-Ukraine System administrator 1, Academika Proskury Mobile UA: +38 050 3642391 Home UA: +380 572 931115 61070 Kharkiv www.ektos.com.ua <http://www.ektos.net/> E-mail: ppo at ektos.net Skype: potcheptsov.pavel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20150507/b738391a/attachment.html>