Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nut.conf:
- MODE=netclient
- upsmon.conf
- RUN_AS_USER root
- MONITOR <ups>@<nut-server> <user> <password> secondary
- MINSUPPLIES 1
- SHUTDOWNCMD "/usr/sbin/shutdown -P +1"
- NOTIFYCMD /usr/sbin/upssched
- POLLFREQ 2
- POLLFREQALERT 1
- HOSTSYNC 900
- DEADTIME 25
- POWERDOWNFLAG /etc/killpower
- 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"
- NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding"
- NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced"
- NOTIFYMSG NOCOMM "UPS %s is unavailable"
- NOTIFYMSG NOPARENT "upsmon parent process died - shutdown impossible"
- NOTIFYFLAG ONLINE SYSLOG+EXEC
- NOTIFYFLAG ONBATT SYSLOG+EXEC
- NOTIFYFLAG LOWBATT SYSLOG+EXEC
- NOTIFYFLAG FSD SYSLOG+EXEC
- NOTIFYFLAG COMMOK SYSLOG+EXEC
- NOTIFYFLAG COMMBAD SYSLOG+EXEC
- NOTIFYFLAG SHUTDOWN SYSLOG+EXEC
- NOTIFYFLAG REPLBATT SYSLOG+EXEC
- NOTIFYFLAG NOCOMM SYSLOG+EXEC
- NOTIFYFLAG NOPARENT SYSLOG
- RBWARNTIME 43200
- NOCOMMWARNTIME 120
- FINALDELAY 5
- upssched-cmd:
- #!/bin/sh
- case $1 in
- onbatt)
- logger -t upssched-cmd "UPS running on battery"
- mail -s "`hostname` has been on battery for 120 seconds, shutting down" -r "[email protected]" "[email protected]" < /dev/null
- /usr/sbin/upsmon -c fsd
- ;;
- earlyshutdown)
- logger -t upssched-cmd "UPS on battery too long, early shutdown"
- mail -s "`hostname` is shutting down, on battery too long" -r "[email protected]" "[email protected]" < /dev/null
- /usr/sbin/upsmon -c fsd
- ;;
- shutdowncritical)
- logger -t upssched-cmd "UPS on battery critical, forced shutdown"
- mail -s "`hostname` is shutting down, battery critical" -r "[email protected]" "[email protected]" < /dev/null
- /usr/sbin/upsmon -c fsd
- ;;
- commbad)
- logger -t upssched-cmd "The server lost communication with UPS"
- ;;
- commok)
- logger -t upssched-cmd "The server re-establish communication with UPS"
- ;;
- upsgone)
- logger -t upssched-cmd "UPS has been gone too long, can't reach"
- ;;
- replacebatt)
- logger -t upssched-cmd "The UPS needs new battery"
- mail -s "The UPS needs new battery" -r "[email protected]" "[email protected]" < /dev/null
- ;;
- *)
- logger -t upssched-cmd "Unrecognized command: $1"
- ;;
- esac
- upssched.conf:
- CMDSCRIPT /etc/nut/upssched-cmd
- PIPEFN /etc/nut/upssched.pipe
- LOCKFN /etc/nut/upssched.lock
- AT ONBATT * START-TIMER onbatt 60
- AT ONLINE * CANCEL-TIMER onbatt online
- AT COMMBAD * START-TIMER commbad 120
- AT COMMOK * CANCEL-TIMER commbad commok
- AT NOCOMM * EXECUTE upsgone
- AT SHUTDOWN * EXECUTE powerdown
- AT REPLBATT * EXECUTE replacebatt
Advertisement
Add Comment
Please, Sign In to add comment