You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
667 B
30 lines
667 B
#!/bin/bash |
|
set -e |
|
|
|
CONFIG_PATH=/data/options.json |
|
|
|
UPSNAME=$(jq --raw-output ".ups.upsname" $CONFIG_PATH) |
|
HOST=$(jq --raw-output ".ups.host" $CONFIG_PATH) |
|
USER=$(jq --raw-output ".credentials.user" $CONFIG_PATH) |
|
PASS=$(jq --raw-output ".credentials.pass" $CONFIG_PATH) |
|
DELAY=$(jq --raw-output ".delay" $CONFIG_PATH) |
|
|
|
echo " |
|
MONITOR ${UPSNAME}@${HOST} 1 ${USER} ${PASS} slave |
|
MINSUPPLIES 1 |
|
SHUTDOWNCMD \"/shutdown.sh\" |
|
POLLFREQ 5 |
|
POLLFREQALERT 5 |
|
HOSTSYNC 15 |
|
DEADTIME 15 |
|
POWERDOWNFLAG /etc/killpower |
|
RBWARNTIME 43200 |
|
NOCOMMWARNTIME 300 |
|
" > /etc/nut/upsmon.conf |
|
|
|
echo "MODE=netclient" > /etc/nut/nut.conf |
|
|
|
# change perms on config files |
|
chmod 660 /etc/nut/* |
|
|
|
upsmon -D
|
|
|