Re: [Nut-upsuser] upssched setup
Roger, Yes thanks I have been using your site as a guide (excellent writeup), trying to work out the difference between OpenSUSE and Ubuntu. I will re-visit this tomorrow and try to tighten up security. Cheers, James > Date: Mon, 27 Apr 2015 23:06:37 +0200 > From: ro...@rogerprice.org > To: nut-upsuser@lists.alioth.debian.org > Subject: Re: [Nut-upsuser] upssched setup > > On Mon, 27 Apr 2015, James Hammond wrote: > > > ... Not too sure where to start with assigning the correct permissions. > > If it is of any help, you will see a full list of the permissions and > owners I use in Table 1 at http://rogerprice.org/NUT.html#SOFT > > Cheers, Roger > > ___ > Nut-upsuser mailing list > Nut-upsuser@lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Re: [Nut-upsuser] upssched setup
On Mon, 27 Apr 2015, James Hammond wrote: ... Not too sure where to start with assigning the correct permissions. If it is of any help, you will see a full list of the permissions and owners I use in Table 1 at http://rogerprice.org/NUT.html#SOFT Cheers, Roger ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Re: [Nut-upsuser] upssched setup
Gents, Thanks, yes definitely a permissions problem. Roger pointed me in the correct direction with the command to add logging for the script. I have the shutdown working now but need to tighten up the permissions. Not too sure where to start with assigning the correct permissions. Cheers, James > Date: Mon, 27 Apr 2015 21:25:45 +0100 > From: n...@dana.org.uk > To: nut-upsuser@lists.alioth.debian.org > Subject: Re: [Nut-upsuser] upssched setup > > Hi, > > The exec is returning 126 - "Command invoked cannot execute. A > permission or command not executable problem.". > > Are you sure that the script is executable by the user running NUT? Do > you have SELinux enabled? > > Regards, > > > Neil. > > On 27/04/15 20:55, James Hammond wrote: > > Hi Roger, > > > > I get: > > > > Apr 27 20:50:05 unifi upsmon[1022]: UPS ups on battery > > Apr 27 20:50:05 unifi upssched[2688]: Timer daemon started > > Apr 27 20:50:06 unifi upssched[2688]: New timer: onbatt (20 seconds) > > Apr 27 20:50:26 unifi upssched[2688]: Event: onbatt > > Apr 27 20:50:26 unifi upssched[2688]: exec_cmd(/sbin/upssched-cmd.sh > > onbatt) returned 126 > > Apr 27 20:50:41 unifi upssched[2688]: Timer queue empty, exiting > > > > > > /etc/nut/upssched.conf > > > > CMDSCRIPT /sbin/upssched-cmd.sh > > PIPEFN /etc/nut/upssched/upssched.pipe > > LOCKFN /etc/nut/upssched/upssched.lock > > AT ONBATT * START-TIMER onbatt 20 > > AT ONLINE * CANCEL-TIMER onbatt > > > > /sbin/upssched-cmd.sh > > > > #!/bin/sh > > # Debugging: Log all calls to this script > > logger -t upssched-cmd.sh Calling upssched-cmd.sh $1 > > case $1 in > > onbatt) > > /sbin/upsmon -c fsd;; > > *) > > echo "shutdown implemented";; > > esac > > > > Any help gratefully received as this has got me beat. Most files > > have been chmod to 777 with no difference. > > > > Cheers, > > > > James > > > > > Date: Mon, 27 Apr 2015 16:04:34 +0200 > > > From: ro...@rogerprice.org > > > To: nut-upsuser@lists.alioth.debian.org > > > Subject: Re: [Nut-upsuser] upssched setup > > > > > > On Mon, 27 Apr 2015, James Hammond wrote: > > > > > > > Roger, I did and it didnt work. > > > > > > Aha!, what does your upssched.conf look like? If you add the lines: > > > > > > # Debugging: Log all calls to this script > > > logger -t upssched-cmd.sh Calling upssched-cmd.sh $1 > > > > > > to your /sbin/upssched-cmd.sh , what is reported if anything when it > > > doesn't work? Cheers, Roger > > > > > > ___ > > > Nut-upsuser mailing list > > > Nut-upsuser@lists.alioth.debian.org > > > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser > > > > > > ___ > > Nut-upsuser mailing list > > Nut-upsuser@lists.alioth.debian.org > > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser > > > > > ___ > Nut-upsuser mailing list > Nut-upsuser@lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Re: [Nut-upsuser] upssched setup
Hi, The exec is returning 126 - "Command invoked cannot execute. A permission or command not executable problem.". Are you sure that the script is executable by the user running NUT? Do you have SELinux enabled? Regards, Neil. On 27/04/15 20:55, James Hammond wrote: Hi Roger, I get: Apr 27 20:50:05 unifi upsmon[1022]: UPS ups on battery Apr 27 20:50:05 unifi upssched[2688]: Timer daemon started Apr 27 20:50:06 unifi upssched[2688]: New timer: onbatt (20 seconds) Apr 27 20:50:26 unifi upssched[2688]: Event: onbatt Apr 27 20:50:26 unifi upssched[2688]: exec_cmd(/sbin/upssched-cmd.sh onbatt) returned 126 Apr 27 20:50:41 unifi upssched[2688]: Timer queue empty, exiting /etc/nut/upssched.conf CMDSCRIPT /sbin/upssched-cmd.sh PIPEFN /etc/nut/upssched/upssched.pipe LOCKFN /etc/nut/upssched/upssched.lock AT ONBATT * START-TIMER onbatt 20 AT ONLINE * CANCEL-TIMER onbatt /sbin/upssched-cmd.sh #!/bin/sh # Debugging: Log all calls to this script logger -t upssched-cmd.sh Calling upssched-cmd.sh $1 case $1 in onbatt) /sbin/upsmon -c fsd;; *) echo "shutdown implemented";; esac Any help gratefully received as this has got me beat. Most files have been chmod to 777 with no difference. Cheers, James > Date: Mon, 27 Apr 2015 16:04:34 +0200 > From: ro...@rogerprice.org > To: nut-upsuser@lists.alioth.debian.org > Subject: Re: [Nut-upsuser] upssched setup > > On Mon, 27 Apr 2015, James Hammond wrote: > > > Roger, I did and it didnt work. > > Aha!, what does your upssched.conf look like? If you add the lines: > > # Debugging: Log all calls to this script > logger -t upssched-cmd.sh Calling upssched-cmd.sh $1 > > to your /sbin/upssched-cmd.sh , what is reported if anything when it > doesn't work? Cheers, Roger > > ___ > Nut-upsuser mailing list > Nut-upsuser@lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Re: [Nut-upsuser] Contact closure UPS?
Nevermind, i'll reply to myself: I made a Megatec M2501 for the RUPS 2000 specification and it worked flawlessly with GENERICUPS driver and upstype=21 (RUPS 2000). COM port state changes with OL/OB states as expected. M2501 cable diagram can be found here: http://www.junradio.com/mid/UPS.htm (Sendon UPS-500 cable) The only thing that doesn't work in this UPS is the UPS shutdown option. As you saw on the picture I posted in my previous message, only pins 2, 4 and 5 are used by this UPS, which means it only supports OL and OB event notifications, leaving pin 6 out of use (shutdown pin in RUPS standard). So, now I have another UPS working on NUT. THANK YOU GUYS!!! On Sun, Apr 26, 2015 at 11:49 PM, Humberto Möckel wrote: > Hello again! I'm yet again the guy from the blazer_usb problem and the > ATCL one too. This time I have a third UPS (the last one In my collection) > that i'm trying to make work instead of the ATCL one since there's no > driver for it on windows. > > This UPS is another no-brand box (actually it is a "kozumi", but that's > just a rebrand), and apparently it's much more basic than the others. It > has only an RS232 port on the back, and I need help finding out what > interface it uses. The chips inside are just voltage comparators and > doesn't seem to have a proper "serial" data interface, it only has a small > board containing a pair of opto couplers going to the DB9 plug. > > You can see pictures of the output board here (onedrive): > > http://1drv.ms/1A3ryEp > > http://1drv.ms/1A3ryEp > > The only pins used seems to be 2, 4 and 5. ¿Is it a RUPS interface? ¿What > cable pinout do I need to build? > > Thanks!!! > > ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Re: [Nut-upsuser] upssched setup
On Mon, 27 Apr 2015, James Hammond wrote: Hi Roger, I get: Apr 27 20:50:05 unifi upsmon[1022]: UPS ups on battery Apr 27 20:50:05 unifi upssched[2688]: Timer daemon started Apr 27 20:50:06 unifi upssched[2688]: New timer: onbatt (20 seconds) Apr 27 20:50:26 unifi upssched[2688]: Event: onbatt Apr 27 20:50:26 unifi upssched[2688]: exec_cmd(/sbin/upssched-cmd.sh onbatt) returned 126 Hi James, On opensuse, man exec says exec [command [argument ...]] ... If command is found, but it is not an executable utility, the exit status shall be 126. Check the man exec on Ubuntu, but it looks like an owner/permissions problem. For me /sbin/upssched-cmd.sh should have permissions -rwxr--r-- and owner upsd:daemon . Any help gratefully received as this has got me beat. Most files have been chmod to 777 with no difference. Please don't leave this 777 in place - it's too dangerous :-) Cheers, Roger ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Re: [Nut-upsuser] upssched setup
Hi Roger, I get: Apr 27 20:50:05 unifi upsmon[1022]: UPS ups on batteryApr 27 20:50:05 unifi upssched[2688]: Timer daemon startedApr 27 20:50:06 unifi upssched[2688]: New timer: onbatt (20 seconds)Apr 27 20:50:26 unifi upssched[2688]: Event: onbattApr 27 20:50:26 unifi upssched[2688]: exec_cmd(/sbin/upssched-cmd.sh onbatt) returned 126Apr 27 20:50:41 unifi upssched[2688]: Timer queue empty, exiting /etc/nut/upssched.conf CMDSCRIPT /sbin/upssched-cmd.shPIPEFN /etc/nut/upssched/upssched.pipeLOCKFN /etc/nut/upssched/upssched.lockAT ONBATT * START-TIMER onbatt 20AT ONLINE * CANCEL-TIMER onbatt /sbin/upssched-cmd.sh #!/bin/sh# Debugging: Log all calls to this scriptlogger -t upssched-cmd.sh Calling upssched-cmd.sh $1 case $1 in onbatt) /sbin/upsmon -c fsd;; *) echo "shutdown implemented";; esac Any help gratefully received as this has got me beat. Most files have been chmod to 777 with no difference. Cheers, James > Date: Mon, 27 Apr 2015 16:04:34 +0200 > From: ro...@rogerprice.org > To: nut-upsuser@lists.alioth.debian.org > Subject: Re: [Nut-upsuser] upssched setup > > On Mon, 27 Apr 2015, James Hammond wrote: > > > Roger, I did and it didnt work. > > Aha!, what does your upssched.conf look like? If you add the lines: > > # Debugging: Log all calls to this script > logger -t upssched-cmd.sh Calling upssched-cmd.sh $1 > > to your /sbin/upssched-cmd.sh , what is reported if anything when it > doesn't work? Cheers, Roger > > ___ > Nut-upsuser mailing list > Nut-upsuser@lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Re: [Nut-upsuser] upssched setup
On Mon, 27 Apr 2015, James Hammond wrote: Roger, I did and it didnt work. Aha!, what does your upssched.conf look like? If you add the lines: # Debugging: Log all calls to this script logger -t upssched-cmd.sh Calling upssched-cmd.sh $1 to your /sbin/upssched-cmd.sh , what is reported if anything when it doesn't work? Cheers, Roger ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Re: [Nut-upsuser] upssched setup
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: ro...@rogerprice.org To: nut-upsuser@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";; > esac Hi, Just wondering, do you have a line in upssched.conf which specifies CMDSCRIPT /sbin/upssched-cmd.sh ? Roger ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
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";; esac Hi, Just wondering, do you have a line in upssched.conf which specifies CMDSCRIPT /sbin/upssched-cmd.sh ? Roger___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
[Nut-upsuser] upssched setup
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@unifi:/sbin# ./upssched-cmd.shshutdown implemented Command run manually works just fine: root@unifi:/# upsmon -c fsdNetwork UPS Tools upsmon 2.7.3 Broadcast Message from nut@unifi(somewhere) at 13:40 ... Executing automatic power-fail shutdown Broadcast Message from nut@unifi(somewhere) at 13:40 ... Auto logout and shutdown proceeding Broadcast message from root@unifi(unknown) at 13:40 ... The system is going down for reboot NOW! Permissions are: root@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@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 ___ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser