Laurent Lesage
2006-May-09 10:59 UTC
[Nut-upsuser] upssched does not start the script when timer triggers
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@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@localhost on line power > May 9 11:40:19 serveur upssched[6823]: Cancelling timer: onbattSo, 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_alertAny idea? thanks ahead Laurent Lesage
Laurent Lesage
2006-May-09 11:10 UTC
[Nut-upsuser] upssched does not start the script when timer triggers
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@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@localhost on line power > May 9 11:40:19 serveur upssched[6823]: Cancelling timer: onbattSo, 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_alertAny idea? thanks ahead Laurent Lesage
Arnaud Quette
2006-May-09 11:19 UTC
[Nut-upsuser] upssched does not start the script when timer triggers
bonjour Laurent, 2006/5/9, Laurent Lesage <laurent@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@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@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/
Charles Lepple
2006-May-09 11:26 UTC
[Nut-upsuser] upssched does not start the script when timer triggers
On 5/9/06, Laurent Lesage <laurent@lesagepono.be> wrote:> > May 9 11:39:49 serveur upssched[6823]: Execute command failure: > > /root/scripts/upsalert phone_alert: No such file or directoryYou can also get this error if the script interpreter (after "#!" - usually /bin/sh, /usr/bin/perl, etc.) has changed names, or if you edited the file on a Windows system and the editor added a stray CR character at the end of the line. Also, as Arnaud pointed out, it could be a permissions problem. Usually, /root would not be readable for the NUT user. -- - Charles Lepple
Charles Lepple
2006-May-17 16:52 UTC
[Nut-upsuser] upssched does not start the script when timer triggers SOLVED
On 5/17/06, Laurent Lesage <laurent@lesagepono.be> wrote:> Well, that's it : I had to "open" a restricted directory of "asterisk" > so tha "nut" is able to write in it. I thought that using the "s" bit on > the script would have given the rights of "root" on the called scripts > and command : I was wrong :-[ . > > Is there an easy way to give the rights of "root" for some scripts > launched by "nut" but not make root execute everything for "nut"?There is a SUID wrapper for perl, but in general, script interpreters do not inherit set-userid privileges. By the way, I think you pointed out a bug in the upssched.c error reporting system - there is a thread on nut-upsdev about this. -- - Charles Lepple