nut/clients/upssched-cmd

33 lines
903 B
Text
Raw Normal View History

2010-03-25 23:20:59 +00:00
#! /bin/sh
#
# This script should be called by upssched via the CMDSCRIPT directive.
#
# Here is a quick example to show how to handle a bunch of possible
# timer names with the help of the case structure.
#
# This script may be replaced with another program without harm.
#
# The first argument passed to your CMDSCRIPT is the name of the timer
# from your AT lines.
case $1 in
2022-06-29 10:37:36 +00:00
onbattwarn)
# Send a notification mail
echo "The UPS has been on battery for awhile" \
| mail -s"UPS monitor" bofh@pager.example.com
# Create a flag-file on the filesystem, for your own processing
/usr/bin/touch /some/path/ups-on-battery
;;
ups-back-on-power)
# Delete the flag-file on the filesystem
/bin/rm -f /some/path/ups-on-battery
;;
2010-03-25 23:20:59 +00:00
upsgone)
2022-06-29 10:37:36 +00:00
logger -t upssched-cmd "The communication with UPS has been gone for awhile"
2010-03-25 23:20:59 +00:00
;;
*)
logger -t upssched-cmd "Unrecognized command: $1"
;;
esac