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: 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: > > > 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 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/f568d207/attachment.html>
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: 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: > > > > > 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 at lists.alioth.debian.org > > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser > > > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser >
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 126Hi 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
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: neil at dana.org.uk > To: nut-upsuser at 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: 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: > > > > > > > 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 at lists.alioth.debian.org > > > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser > > > > > > _______________________________________________ > > Nut-upsuser mailing list > > Nut-upsuser at lists.alioth.debian.org > > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser > > > > > _______________________________________________ > 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/faea2e1b/attachment.html>