HTTP domoticz connection recurrent issue

domoI do not know if this is the case for other people but on my rasberry, sometimes I do not have the http access to domoticz webpage. The only solution is to connect on the ssh server and restart domoticz or completely the raspberry. This may cause problem is you are not at home and if you do not have access to ssh to your raspberry. In that case , the only solution is to wait to go back to home… ūüôĀ

After some research in the logs and not domoticz Rasperry  i did not find the root cause of the  the crash. I see that the domoticz logs continues as if nothing happened but the web server still not answering. This happens quite frequently, about 3-4 times a month.

To avoid this¬†problem I created a small script which¬†will regularly test the http access to domoticz and if it found http connection problem the script will restart domoticz. Realy siple script but I think it can be helpfull for someone having the same issue…

To be added in the root crontab :

# Check http access
*/2 * * * *  /root/scripts/test_http.sh >> /tmp/test_http_access.log

Script to be created : /root/scripts/test_http.sh

#!/usr/bin/ksh
################################################################
#
# This script will test the domoticz http web access
#
################################################################
# test connexion with max 5s
curl -s http://<raspberry IP>:<PORT> -m 5 > /dev/null
CR=$?


if [ $CR != 0 ]
then
        echo "`date` Probleme RC=$CR"
        echo "Restarting Domoticz"
        /etc/init.d/domoticz.sh restart

else
        echo "`date`  RAS code retour $CR "
fi

I set up this script several months ago, since no problem. I can see the errors in the log file and restart the domoticz:

root@raspberrypi:~# grep -v RAS /tmp/test_http_access.log
Thu May 14 20:48:07 CEST 2015 Probleme RC=28
Restarting Domoticz
Restarting Domoticz Home Automation System: domoticz2015-05-14 20:48:12.001  Domoticz V2.2286 (c)2012-2015 GizMoCuz
2015-05-14 20:48:12.002  System: Raspberry Pi
2015-05-14 20:48:12.002  Startup Path: /home/pi/domoticz/
.
Thu May 14 21:00:07 CEST 2015 Probleme RC=28
Restarting Domoticz
Restarting Domoticz Home Automation System: domoticz2015-05-14 21:00:12.116  Domoticz V2.2286 (c)2012-2015 GizMoCuz
2015-05-14 21:00:12.117  System: Raspberry Pi
2015-05-14 21:00:12.118  Startup Path: /home/pi/domoticz/
.
Thu May 14 21:32:01 CEST 2015 Probleme RC=7
Restarting Domoticz
Restarting Domoticz Home Automation System: domoticz2015-05-14 21:32:31.639  Domoticz V2.2286 (c)2012-2015 GizMoCuz
2015-05-14 21:32:31.640  System: Raspberry Pi
2015-05-14 21:32:31.641  Startup Path: /home/pi/domoticz/
.

Leave a Reply

Your email address will not be published. Required fields are marked *