improved script reliability

This commit is contained in:
Your Name 2021-07-01 20:40:51 +02:00
parent 7c9a0bf6f1
commit d2010ddebb

View File

@ -16,6 +16,7 @@ mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/stay/alive/set" -m "1" -r
echo "Waiting ..." echo "Waiting ..."
mosquitto_sub -h $mqttHost -t "${mqttPrefix}${homieId}/#" -R -C 1 mosquitto_sub -h $mqttHost -t "${mqttPrefix}${homieId}/#" -R -C 1
set -e set -e
sleep 30
mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/\$implementation/config/set" -m "{ mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/\$implementation/config/set" -m "{
\"settings\": { \"settings\": {
\"sleep\":600, \"sleep\":600,
@ -64,11 +65,12 @@ mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/\$implementation/config/s
\"lowLight6\": false, \"lowLight6\": false,
\"delay6\": 10 \"delay6\": 10
} }
}" -r }"
echo "Waiting for reboot" echo "Waiting for reboot"
sleep 1 sleep 1
mosquitto_sub -h $mqttHost -t "${mqttPrefix}${homieId}/#" -R -C 1 mosquitto_sub -h $mqttHost -t "${mqttPrefix}${homieId}/#" -R -C 1
sleep 20
mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/config/backup/set" -m "true" -r mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/config/backup/set" -m "true" -r
sleep 5
mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/stay/alive/set" -m "0" -r mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/stay/alive/set" -m "0" -r
exit 0 exit 0