From c69c4775a0194b39745b00b8bae386a056b4f1ad Mon Sep 17 00:00:00 2001 From: Gilles Grandou Date: Sat, 23 Apr 2022 16:29:46 +0200 Subject: [PATCH] restart_script * run hourly from crontab * workaround for killed script on Shelly --- restart_script | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 restart_script diff --git a/restart_script b/restart_script new file mode 100755 index 0000000..2c20c35 --- /dev/null +++ b/restart_script @@ -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 . +