[Nut-upsuser] HowTo use upssched right.

Gregor Burck gregor at aeppelbroe.de
Fri Mar 8 09:55:03 UTC 2013


Hi,

I want to test the events off my UPS.

I define
In upsmon.conf:

RUN_AS_USER root
NOTIFYCMD /sbin/upssched

NOTIFYMSG ONLINE "UPS %s on line power"
NOTIFYMSG ONBATT "UPS %s on battery"
NOTIFYMSG LOWBATT "UPS %s battery is low"
# NOTIFYMSG FSD "UPS %s: forced shutdown in progress"
NOTIFYMSG COMMOK "Communications with UPS %s established"
NOTIFYMSG COMMBAD "Communications with UPS %s lost"

NOTIFYFLAG ONLINE SYSLOG+EXEC
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG LOWBATT SYSLOG+EXEC
# NOTIFYFLAG FSD SYSLOG+WALL
NOTIFYFLAG COMMOK SYSLOG+EXEC
NOTIFYFLAG COMMBAD SYSLOG+EXEC

In upssched.conf:
CMDSCRIPT /etc/nut/upssched/upssched.sh
PIPEFN /etc/nut/upssched/upssched.pipe
LOCKFN /etc/nut/upssched/upssched.lock

AT ONBATT * EXEC ONBATT
AT ONLINE * EXEC ONLINE
AT LOWBATT * EXEC LOWBATT

In upssched/upssched.sh:
#! /bin/bash
case $1 in
 ONBATT)
 echo "onbatt " $(date) >> /var/log/upssched-bin.log ;;
 ONLINE)
 echo "online " $(date) >> /var/log/upssched-bin.log ;;
 LOWBATT)
 echo "lowbatt " $(date) >> /var/log/upssched-bin.log ;;
 COMMOK)
 echo "commok " $(date) >> /var/log/upssched-bin.log ;;
 COMMBAD)
 echo "commbad " $(date) >> /var/log/upssched-bin.log ;;
 *)
 echo "Falscher Parameter " $(date) >> /var/log/upssched-bin.log ;;
esac

When I test the script directly I get a entry to the log file.
When I disconect the USB connection I get some entry in the syslog, but not in my own log.

Could I test the upssched like '/sbin/upssched UPS1 FLAG' ? I get then
Error: UPSNAME and NOTIFYTYPE must be set.
This program should only be run from upsmon.

Thank you for help.

Gregor
-- 






More information about the Nut-upsuser mailing list