12345678910111213141516171819202122232425262728 |
- #!/bin/sh
- # monitor "jeelink2mqtt.py"
- logfile="/home/pi/jeelink2mqtt_wdog.log"
- statfile=/tmp/jeelink2mqtt_running
- timestmp=`date "+%Y-%m-%d %H:%M:%S"`
- echo $timestmp starting wdog...>> $logfile
- while :
- do
- if [ -f "$statfile" ]
- then
- if test `find "$statfile" -mmin +2` # Statusfile darf maximal 2 Minuten alt sein, sonst hängt vermutlich etwas (WS liefert mindestens alle 60s was)
- then
- timestmp=`date "+%Y-%m-%d %H:%M:%S"`
- echo $timestmp statusfile too old - jeelink2mqtt..py seems to hang - restarting >> $logfile
- #killall wettersensoren.py
- systemctl restart jeelink2mqtt.service
- fi
- else
- timestmp=`date "+%Y-%m-%d %H:%M:%S"`
- echo $timestmp statusfile does not exist - jeelink2mqtt.py seems not to be running - restarting >> $logfile
- #killall wettersensoren.py
- systemctl restart jeelink2mqtt.service
- fi
- sleep 60
- done
|