shelly_pool/restart_script
Gilles Grandou c69c4775a0 restart_script
* run hourly from crontab
* workaround for killed script on Shelly
2022-09-01 21:29:39 +02:00

21 lines
426 B
Bash
Executable File

#!/bin/bash -e
source $(dirname $0)/shelly.conf
run=$(curl -s "${SHELLY_RPC}/Script.GetStatus?id=${SCRIPT_ID}" | jq .running)
test "$run" = true && exit
echo "restart script"
curl -s "${SHELLY_RPC}/Script.Start?id=${SCRIPT_ID}"
run=$(curl -s "${SHELLY_RPC}/Script.GetStatus?id=${SCRIPT_ID}" | jq .running)
if [ $run = true ]; then
echo "OK"
else
echo "ERROR"
fi
echo
curl -s "${SHELLY_RPC}/Sys.GetStatus" | jq .