Hi Pedro,
2006/11/21, Pedro Bonfiglio
<pedro.bonfiglio@refert.com>:> Hi, I'm having problems to configure upssched in order to notify me
only
> when the disconnection exceeds the 30 seconds.
> Now, I'm getting a mail if it is disconnected just for a second, or
even
> worse, when I got low tension.
> So, mail notifications are well configured, I guess...
> I think the problem is in upssched.
> I'm new to this, so it could be a stupid thing that I'm missing...
>
> My configurations files are like this:
>
> *ups.conf:*
>
> [ups0]
> driver = mge-shut
> port = /dev/ttyS0 #It's serial, not USB
>
>
> *upsmon.conf:*
>
> # NOTIFYCMD <command>
> NOTIFYCMD /usr/local/ups/bin/notifyme
you there need to call upsched
I know the doc is wrong about that...
> # POWERDOWNFLAG - Flag file for forcing UPS shutdown on the master system
> POWERDOWNFLAG /etc/killpower
> # This file is supposed to be created by NUT when a disconnection
> occurs, but I didn't see it. Am I right?
the POWERDOWNFLAG is only created when we reach the battery.charge.low
to inform the nut init script to perform a UPS poweroff.
>
> *upssched.conf:*
>
> # CMDSCRIPT <scriptname>
> CMDSCRIPT /usr/local/ups/bin/upssched-cmd
>
> # PIPEFN <filename>
> PIPEFN /var/run/upssched/upssched.pipe
>
> # LOCKFN <filename>
> LOCKFN /var/run/upssched/upssched.lock
> #The directory /var/run/upssched is world-writable so both files could
> be created, but it is actually empty.
>
> # Possible AT commands
> AT ONBATT * START-TIMER upsgone 30
do you have declared the matching cancelation, ie:
AT ONLINE * CANCEL-TIMER upsgone
>
> Then, I got two more files in */usr/local/ups/bin*: notifyme and
> upssched-cmd
>
> *notifyme:*
>
> #!/bin/sh
> echo "$@" | mail -s "[NUT] Notify" mail@address
>
>
> *upssched-cmd:*
>
> case $1 in
> upsgone)
> echo "The UPS has been on battery for awhile" \
> | mail -s "[NUT] Notify" mail@address
> ups-back-on-line)
> /bin/rm -f /var/run/upssched/ups-on-battery
> *)
> logger -t upssched-cmd "Unrecognized command: $1"
> ;;
> esac
>
>
> All advices will be welcome
so, according to your conf, you'll have a mail for each event occuring...
QED
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/