[Nut-upsuser] upssched does not start the script when timer triggers

Laurent Lesage laurent at lesagepono.be
Wed May 17 10:23:39 UTC 2006


Hello!

I didn't here from you anymore... SO I send again.

thanks ahead for answering, even if you have no idea ;-)

Laurent

----------copy of the last mail sent on 09/05/06-----------

merci pour votre réactivité (don't know how to say it in English!)

Well, I think everything you pointed out is ok. but it doesn't work!
I give you the "whole thing" :

> serveur:/var/run/upssched#* ls -ld*
> drwxr-x---  2 nut nut 1024 2006-05-09 17:04 .

> serveur:/etc/nut# *ls -l*
> -rwxr-x---  1 nut  nut   66 2006-05-09 10:56 upsalert
> -rw-r-----  1 root nut  392 2005-09-08 20:09 upsmon.conf
> -rw-r-----  1 root nut  441 2006-05-09 16:22 upssched.conf

> serveur:/etc/nut# *cat upssched.conf*
> # the script to be executed
> CMDSCRIPT /etc/nut/upsalert
>
> # mandatory fields that must be set before AT commands
> PIPEFN /var/run/upssched/upssched.pipe
> LOCKFN /var/run/upssched/upssched.lock
>
> # the timers, here 30 sec after the ONBATT (ups on battery) event
> AT ONBATT * START-TIMER phone_alert 15
> AT ONBATT * START-TIMER onbatt 900
>
> # cancel the countdown if power is back
> AT ONLINE * CANCEL-TIMER onbatt
> AT ONLINE * CANCEL-TIMER phone_alert

> serveur:/etc/nut#* cat upsalert*
> #!/bin/bash
> case "$1" in
>         phone_alert)
>                 echo "alerte téléphonique `date`">> /etc/nut/testphone
>                 cp /etc/nut/essai.call /etc/nut/essai1.call
>                 chmod a+rwx /etc/nut/essai1.call
>                 mv /etc/nut/essai1.call /var/spool/asterisk/outgoing
>         ;;
>
>         onbatt)
> # send mail to admin
> echo "Power is lost, UPS is shutting down servers." | mail -s "UPS 
> ALERT" root at lesagepono.be
> # write to a specific log file
> date=$(date "+%F %T")
> echo "$date >> UPS ALERT, shutting down in a few seconds..." >> 
> /var/log/ups.log
> upsc ellipse at localhost >> /var/log/ups.log
> echo `upsc ellipse at localhost` | mail -s "Etat ups à l'arrêt" 
> root at lesagepono.be
> # actually send the shutdown signal to master (will broadcast to all 
> slaves)
> /sbin/upsmon -c fsd
>         ;;
>
> esac

And always the same story ....
/var/log/syslog --->

> y  9 18:00:16 serveur upsmon[6411]: UPS ellipse at localhost on battery
> May  9 18:00:16 serveur upssched[8926]: Timer daemon started
> May  9 18:00:16 serveur upssched[8926]: New timer: phone_alert (15 
> seconds)
> May  9 18:00:16 serveur upssched[8926]: New timer: onbatt (900 seconds)
> May  9 18:00:31 serveur upssched[8926]: Event: phone_alert
> May  9 18:00:31 serveur upssched[8926]: Execute command failure: 
> /etc/nut/upsalert phone_alert: No such file or directory
> May  9 18:01:11 serveur upsmon[6411]: UPS ellipse at localhost on line power
> May  9 18:01:11 serveur upssched[8926]: Cancelling timer: onbatt
> May  9 18:01:21 serveur upssched[8926]: Timer queue empty, exiting
> May  9 18:01:30 serveur in.qpopper[8932]: connect from 192.168.0.74 
> (192.168.0.74)

thanks ahead again...

Laurent


Arnaud Quette wrote:

> bonjour Laurent,
>
> 2006/5/9, Laurent Lesage <laurent at lesagepono.be>:
>
>> Hello,
>>
>> I'm using nut with my MG Ellipse on serial port. No problem since one
>> year. Two days ago, I wanted to add a phone alert through my asterisk
>> box when power is down. Since then, upssched doesn't make his job
>> anymore. here is the "syslog" I get when the power cord is unplugged :
>>
>> >
>> > May  9 11:39:34 serveur upsmon[6411]: UPS ellipse at localhost on battery
>> > May  9 11:39:34 serveur upssched[6823]: Timer daemon started
>> > May  9 11:39:34 serveur upssched[6823]: New timer: phone_alert (15
>> > seconds)
>> > May  9 11:39:34 serveur upssched[6823]: New timer: onbatt (900 
>> seconds)
>> > May  9 11:39:49 serveur upssched[6823]: Event: phone_alert
>> > May  9 11:39:49 serveur upssched[6823]: Execute command failure:
>> > /root/scripts/upsalert phone_alert: No such file or directory
>> > May  9 11:40:19 serveur upsmon[6411]: UPS ellipse at localhost on line 
>> power
>> > May  9 11:40:19 serveur upssched[6823]: Cancelling timer: onbatt
>>
>>
>>
>> So, the timer works OK but when the scripts si called, it says it
>> doesn't exist. It worked before without any problem. the path is ok. The
>> command is ok.
>>
>> her is my upssched.conf
>>
>> > # the script to be executed
>> > CMDSCRIPT /root/scripts/upsalert
>> >
>> > # mandatory fields that must be set before AT commands
>> > PIPEFN /var/run/upssched/upssched.pipe
>> > LOCKFN /var/run/upssched/upssched.lock
>> >
>> > # the timers, here 30 sec after the ONBATT (ups on battery) event
>> > AT ONBATT * START-TIMER phone_alert 15
>> > AT ONBATT * START-TIMER onbatt 900
>> >
>> > # cancel the countdown if power is back
>> > AT ONLINE * CANCEL-TIMER onbatt
>> > AT ONLINE * CANCEL-TIMER phone_alert
>>
>>
>>
>> Any idea?
>
>
> please, also post the upsalert script.
> I take it that you checked /var/run/upssched/ can be accessed by the 
> nut user.
>
> Strange that it worked before! I would have suggested that either a
> dir in the path (/var/run/upssched/ or more /root/scripts/) would not
> give access to the nut user, or the script itself not being
> executable.
> It might be that, but due to a package upgrade that would have changed
> something...
>
> Don't hesitate to get back to me when you have validated the above 
> points.
>
> Arnaud
> -- 
> Linux / Unix Expert - MGE UPS SYSTEMS - R&D Dpt
> Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
> Debian Developer - http://people.debian.org/~aquette/
> OpenSource Developer - http://arnaud.quette.free.fr/
>
>



_______________________________________________
Nut-upsuser mailing list
Nut-upsuser at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser





More information about the Nut-upsuser mailing list