On Mon, 3 Jul 2017, Andrea de Lutti wrote:
MONITOR dummy@artu 1 user pass master
SHUTDOWNCMD "/sbin/shutdown -h +0"
NOTIFYCMD /usr/local/bin/upssched-script
Hi, As far as I can see, what you are getting in syslog corresponds
correctly to what you have specified. You have specified that upsmon is
to call upssched-script _directly_. This means that the argument to the
script call will be the NOTIFYMSG value. But in upssched-script you are
testing for the notifytype, e.g. ONBATT.
Did you want that, or did you want NOTIFYCMD to point to upssched?
If I may throw away modesty, see chapter 4 in
http://rogerprice.org/NUT/ConfigExamples.A5.pdf which has a diagram and a
fully worked example.
Roger
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
...
# Network UPS Tools - upssched.conf sample file
#
# ============================================================================
CMDSCRIPT /usr/local/bin/upssched-script
PIPEFN /var/run/nut/upssched/upssched.pipe
LOCKFN /var/run/nut/upssched/upssched.lock
AT ONBATT * EXECUTE onbattwarn
AT ONLINE * EXECUTE ups-back-on-power
The upssched-script is
#! /bin/sh
case "$1" in
"ONBATT")
echo "On batt" | mailx -v -r "adelu...@gmail.com" -s "TEST NUT object" -S
smtp="smtp.gmail.com:587" -S smtp-use-starttls -S smtp-auth=login -S
smtp-auth-user="adelu...@gmail.com" -S smtp-auth-password="gtmtnqyelhlumyds" -S
ssl-verify=ignore adelutti+ser...@gmail.com
;;
.......
*)
logger -t upssched-cmd "Unrecognized command: $1"
;;
esac
while upssched.conf is
Running upson in debug mode I can see the change of the status (I have a cycle
of 30 secs for online/batterry/low battery) but the syslog reports
Jul 3 16:17:15 artu upsmon[4685]: UPS dummy@artu on battery
Jul 3 16:17:15 artu upssched-cmd: Unrecognized command: UPS dummy@artu on
battery
_______________________________________________
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser