restart_script

* run hourly from crontab
* workaround for killed script on Shelly
This commit is contained in:
Gilles Grandou 2022-04-23 16:29:46 +02:00
parent eb8584a576
commit c69c4775a0
1 changed files with 20 additions and 0 deletions

20
restart_script Executable file
View File

@ -0,0 +1,20 @@
#!/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 .