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 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 while true; do
upsinfo=$(upsc CP1500PFCLCD) upsinfo=$(upsc CP1500PFCLCD)
if [ "${upsinfo}" != "" ]; then if [ "${upsinfo}" != "" ]; then
@@ -90,17 +90,23 @@ BATT RUNTIME: ${OFFSITE_BATT_RUNTIME}'Mins" 1
done done
} }
STOP(){ PWO_STOP(){
ps | grep "offsite-power-check.sh" | grep -v "grep" | awk '{print $1}' | xargs kill ps | grep "offsite-power-check.sh" | grep -v "grep" | awk '{print $1}' | xargs kill
} }
PWO_RESTART() {
PWO_STOP
PWO_START
}
case ${1} in case $1 in
start) START &;; start) PWO_START &;;
stop) STOP;; stop) PWO_STOP;;
restart) PWO_RESTART;;
esac esac
exit 0 exit 0