Update offsite-power-check.sh

This commit is contained in:
2023-11-05 19:04:02 -06:00
parent 7f78e0d7fa
commit 607b5ba121

View File

@@ -32,7 +32,7 @@ $(date)"
curl -d "token=${PUSHOVER_APP_TOKEN}&user=${PUSHOVER_USER_TOKEN}&message=${MESSAGE}&title=${TITLE}&priority=${PRIORITY}&sound=${MSGSOUND}" https://api.pushover.net/1/messages.json
}
START(){
PWO_START(){
while true; do
upsinfo=$(upsc CP1500PFCLCD)
if [ "${upsinfo}" != "" ]; then
@@ -90,17 +90,23 @@ BATT RUNTIME: ${OFFSITE_BATT_RUNTIME}'Mins" 1
done
}
STOP(){
PWO_STOP(){
ps | grep "offsite-power-check.sh" | grep -v "grep" | awk '{print $1}' | xargs kill
}
PWO_RESTART() {
PWO_STOP
PWO_START
}
case ${1} in
start) START &;;
stop) STOP;;
case $1 in
start) PWO_START &;;
stop) PWO_STOP;;
restart) PWO_RESTART;;
esac
exit 0