Monitor and then Restart Domoticz Automatically if it stops

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Monitor and then Restart Domoticz Automatically if it stops

Post by thebeetleuk »

Hi all,

I've tried searching the forum but I cant quite see this anywhere.

Every so often (i.e. again today when my wife tried to use the heating!!) Domoticz doesn't display anything through the browser and I have just restarted my pi. Finally today I'g going to attempt to resolve the issue so I was thinking I could monitor domoticz to make sure I am still getting a reply and if not then restart using

sudo service domoticz.sh stop
sudo service domoticz.sh start

Any ideas how I can do this?

Thanks!!
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
User avatar
cyberclwn
Posts: 103
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by cyberclwn »

3xPi 2B (Domoticz "live", Domoticz "sandbox", PhotoFrame)
RFXCom433(E), KaKu, Oregon Scientific, Keyes 2-relay, Logitech Media Server, MiLight, Smartwares heating controller(2x), IR Send/Receive, Keyes PIR, XH-M131 DuskSensor, DHT22/11
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by stlaha2007 »

I can underscribe the Monit-solution to keep Domoticz up and running.

But check to be sure that it is domoticz which is failing.

Happened to me just a few times with the stable version. Enable logging to file, seems to be disabled by default! And write to a remote location (using nfs-export on NAS myself). And see that it ia definedly domoticz stopping.

When it happened to me most of the time mobile/wifi device disconnected earlier. Refresh returned with no devices.

Now using Monit to keep Domoticz up and running. Webinterface comes handy in the case that Domoticz isnt available so restart service/restart pi. And mobile android-devices configured with a home-screen shortcut that makes the Domoticz dashboard a WepApp.
Running two weeks now without probs for now.



Sent from my D6503 using Tapatalk
korniza
Posts: 157
Joined: Thursday 27 August 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6028
Location: Greece
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by korniza »

Well I have issues with wifi and raspberry and some "unknown" crashed of domoticz itself.

First solved from this link -> http://iqjar.com/jar/raspberry-pi-reboo ... -networks/
I have also a second domoticz slave server and they inter-control each other!

Second solved by this post -> http://www.domoticz.com/forum/viewtopic ... 016#p46752
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
joshimosh
Posts: 58
Joined: Friday 29 May 2015 7:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by joshimosh »

Monit is the way to go.

I am using the latest beta of Domoticz and it is very stable - at least in my environment. I do not upgrade to the latest beta as soon as it becomes available, but wait for a couple of days, checking this forum for problem reports. In my experience it is relatively safe to upgrade after a week or so when it is quiet in the forum.
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by Eduard »

I use a simple bash-script wich is run every minute by crontab:

Code: Select all

#!/bin/bash

if [[ ! "$(sudo service domoticz.sh status)" =~ "domoticz is running" ]]
then
  if [ ! -f /tmp/stopdomo ]; then
    echo "`date`: Domoticz not running - restarting..."
    sudo service domoticz.sh start
    echo "`date`: Domoticz restarted!"
  fi
else
  if [ -f /tmp/stopdomo ]; then
    echo "`date`: Domoticz is running - stopping..."
    sudo service domoticz.sh stop
    echo "`date`: Domoticz stopped!"
  fi
fi
If i don't want to auto-start Domoticz, i place a dummy-file named 'stopdomo' in /tmp
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by thebeetleuk »

Wow thanks everyone. I'll try some of these tonight!!
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
Robert
Posts: 16
Joined: Saturday 01 March 2014 18:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by Robert »

It's not very normal that domoticz stops, but it can happens . See if you did expand your sd card and use the full size. Mostly (for me) the sd card was causing the trouble. Setting up a fresh domoticz may also help. Use monit, there is nu better solution:-) if you need help to setup, please let us know. Good luck !



Verzonden vanaf mijn iPhone met Tapatalk
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by Derik »

How is this script acting when you update Domoticz?
Is there no problem ?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by thebeetleuk »

Robert wrote:It's not very normal that domoticz stops, but it can happens . See if you did expand your sd card and use the full size. Mostly (for me) the sd card was causing the trouble. Setting up a fresh domoticz may also help. Use monit, there is nu better solution:-) if you need help to setup, please let us know. Good luck !

Verzonden vanaf mijn iPhone met Tapatalk
Still trying to work out what's stopping. its not the SD card as I expanded as soon as I setup over a year ago.

Strangely one of my friends who also has Domiticz has the same periodic issues as me. The web gui appears to stop working.

How do I enable logging on domotics to check for errors?
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by thebeetleuk »

Derik wrote:How is this script acting when you update Domoticz?
Is there no problem ?
No problem here but not sure how this would impact anything
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by thebeetleuk »

P.s. I still need to investigate more. I have been side tracked with a lua script that sends me a notification me a message each time a spend a £1 on electricity. all done now so back to this :)
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by jake »

korniza wrote:Well I have issues with wifi and raspberry and some "unknown" crashed of domoticz itself.

First solved from this link -> http://iqjar.com/jar/raspberry-pi-reboo ... -networks/
I have also a second domoticz slave server and they inter-control each other!

Second solved by this post -> http://www.domoticz.com/forum/viewtopic ... 016#p46752
When 2rpi's are checking each other, both will reboot when 1 fails: the one failing won't leave the trace behind on the second rpi, which will think that it has a problem itself

Or do I miss something?
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by stlaha2007 »

@jake, don't think your missing something.
If one fails it can't leave an error on second.

@thebeetleuk
Anyway: enable logging to /var/log/ etcetera. Basic raspian does some itself!
Domoticz enable in /etc/init.d/domoticz.sh
Also look into daemon en message logfiles.

Try do get some lines from those with the errors/crashes including some before and after.
Makes it easier for us to understand where its failing.


Sent from my D6503 using Tapatalk
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Monitor and then Restart Domoticz Automatically if it st

Post by thebeetleuk »

I have something to restart. A slight modification to what is on the wiki but it seems to work. I'll need to add a line to notify me when it restarts and then I can investigate the logs.
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest