Script to restart Domoticz if it crashes Topic is solved
Moderator: leecollings
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Script to restart Domoticz if it crashes
yep i use only a cable and no wifi..
Are tere the solutions to?
Are tere the solutions to?
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
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Script to restart Domoticz if it crashes
I mean the name of the network interface. You can find it with ifconfig. Useally that's eth0 or wlan0
-
- Posts: 625
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.2
- Location: Geleen
- Contact:
Re: Script to restart Domoticz if it crashes
Why stop the network interface? I use tons of unix/linux systems, including some pi's, I never stop/start a network interface unless I am working on it.
Verstuurd vanaf mijn SM-G930F met Tapatalk
Verstuurd vanaf mijn SM-G930F met Tapatalk
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Script to restart Domoticz if it crashes
Because his device looses network connection. It's better to first try if a restart of network avoids the problem than rebooting.
http://www.domoticz.com/forum/viewtopic ... 20#p152494
http://www.domoticz.com/forum/viewtopic ... 20#p152494
-
- Posts: 625
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.2
- Location: Geleen
- Contact:
Re: Script to restart Domoticz if it crashes
But what is the cause of the network loss?
Verstuurd vanaf mijn SM-G930F met Tapatalk
Verstuurd vanaf mijn SM-G930F met Tapatalk
-
- Posts: 843
- Joined: Sunday 23 February 2014 17:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: mixed
- Location: Hengelo(Ov)/NL
- Contact:
Re: Script to restart Domoticz if it crashes
Really a pain-in-the-ass if a 'countermeasure' is not reliable.
Besides a 'user' cron with more lines, in the 'sudo' cron I put a simple, single line for periodic reboot, but apparently even that does not work.
Even worse, sometimes I see that after the ordered reboot the applications/scripts do not start ( 'obviously' that occurs most of the times at the 'night-reboot' of 04:11).
Presently don't see another practical solution than a 'habit' to remotely/manually reboot when opening respectively closing my PC-sessions:
stupid/rude, but at least a frequent kick to the Raspberries for clean start.
For other part not really a crash of Domoticz, but more a matter of one or more lua-script(s) which stop(s) running.
Stop occurring semi-randomly, sometimes at 00:00 and sometimes elsewhere.
Nuisance if you want continuity e.g. for power-meaurement or meteo-dataregistration (as described before).
Can usually be solved by the manual reboot, but nevertheless gaps in registration, because you are never in time to detect&close the gap.
Looked at Power Supply as possible source for corruption, but that seems OK.
Looking for other solutions:
1) Manual reboot always works through PuttySSH by manual CLI-command sudo reboot.
Is there a way to 'automate' such function as remote input from another computer?
2) Not use cron, but use a separate, dedicated script to order reboot (hoping that that 'reboot'-script stays running).
That 'reboot'-script acting on a flag from the suspect script which indicates heartbeat-present. Time-out on heartbeat = action = reboot-command
Any idea how to fit a 'flag' in the suspect script, which can be read as heartbeat-signal by the 'reboot'-script?
Simple&Rude Setup1 seems to be
a) the suspect script transmits it's time to a Dummy,
b) if the script stops, no further transmission and the time in the Dummy freezes
c) 'reboot'-script reads the Dummy and compares against current systemtime,
d) Defined difference = Time-out detection = order reboot.
Myself have been looking/experimenting on mechanisms directly getting&checking validity-time of data through JSON-calls (which Setup2 is essentally the same as Setup1, but without the Dummy as intermediary), but not yet found/made a reliable script: for status see here.
Setup1 and Setup2 could both be run locally at the Raspberry (for 'close-loop' reboot) or can be remotely run on another computer (for 'remote' reboot).
Besides a 'user' cron with more lines, in the 'sudo' cron I put a simple, single line for periodic reboot, but apparently even that does not work.
Even worse, sometimes I see that after the ordered reboot the applications/scripts do not start ( 'obviously' that occurs most of the times at the 'night-reboot' of 04:11).
Code: Select all
11 4/12/20 * * * sudo reboot
stupid/rude, but at least a frequent kick to the Raspberries for clean start.
For other part not really a crash of Domoticz, but more a matter of one or more lua-script(s) which stop(s) running.
Stop occurring semi-randomly, sometimes at 00:00 and sometimes elsewhere.
Nuisance if you want continuity e.g. for power-meaurement or meteo-dataregistration (as described before).
Can usually be solved by the manual reboot, but nevertheless gaps in registration, because you are never in time to detect&close the gap.
Looked at Power Supply as possible source for corruption, but that seems OK.
Looking for other solutions:
1) Manual reboot always works through PuttySSH by manual CLI-command sudo reboot.
Is there a way to 'automate' such function as remote input from another computer?
2) Not use cron, but use a separate, dedicated script to order reboot (hoping that that 'reboot'-script stays running).
That 'reboot'-script acting on a flag from the suspect script which indicates heartbeat-present. Time-out on heartbeat = action = reboot-command
Any idea how to fit a 'flag' in the suspect script, which can be read as heartbeat-signal by the 'reboot'-script?
Simple&Rude Setup1 seems to be
a) the suspect script transmits it's time to a Dummy,
b) if the script stops, no further transmission and the time in the Dummy freezes
c) 'reboot'-script reads the Dummy and compares against current systemtime,
d) Defined difference = Time-out detection = order reboot.
Myself have been looking/experimenting on mechanisms directly getting&checking validity-time of data through JSON-calls (which Setup2 is essentally the same as Setup1, but without the Dummy as intermediary), but not yet found/made a reliable script: for status see here.
Setup1 and Setup2 could both be run locally at the Raspberry (for 'close-loop' reboot) or can be remotely run on another computer (for 'remote' reboot).
Last edited by Toulon7559 on Saturday 17 August 2019 10:01, edited 10 times in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
-
- Posts: 843
- Joined: Sunday 23 February 2014 17:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: mixed
- Location: Hengelo(Ov)/NL
- Contact:
Re: Script to restart Domoticz if it crashes
Reading back info from a website as an indicator whether "the link & upload & the uploading computer is operational" has it's limitations, because sometimes the website or the receiving application extrapolates data, and then in the read-out you get info including validity time, which apparently is valid, although the related upload has stopped.
Perhaps another approach ...
My setup periodically uploads info to several websites.
- WUnderground and AWEKAS (for meteo-data) report after een time-out by mailnotification that upload is missing:
- WUnderground has a fixed time-out of 2 hours
- AWEKAS is even better with a time-out adjustable by the user.
- At PVOutput.org I found under the title Register Notification Service something which could be applicable, because you can make a http-call to see whether/which alert is applicable, but that function misses an alert for time-out.
Is there a way to link such incoming notification to one of the crash-scripts in this thread (or to another script that can remotely trigger a reboot)?
Obviously such mechanism only operates if the processor & Domoticz is still running, but only the subject uploading script has stopped.
If the processor really crashed, nothing helps but brute, manual forced reboot etc.
Perhaps another approach ...
My setup periodically uploads info to several websites.
- WUnderground and AWEKAS (for meteo-data) report after een time-out by mailnotification that upload is missing:
- WUnderground has a fixed time-out of 2 hours
- AWEKAS is even better with a time-out adjustable by the user.
- At PVOutput.org I found under the title Register Notification Service something which could be applicable, because you can make a http-call to see whether/which alert is applicable, but that function misses an alert for time-out.
Is there a way to link such incoming notification to one of the crash-scripts in this thread (or to another script that can remotely trigger a reboot)?
Obviously such mechanism only operates if the processor & Domoticz is still running, but only the subject uploading script has stopped.
If the processor really crashed, nothing helps but brute, manual forced reboot etc.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
-
- Posts: 34
- Joined: Friday 17 June 2016 7:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spijkenisse
- Contact:
Re: Script to restart Domoticz if it crashes
Hello,
When I have use one of the on my RPi 3, how do I check if it works?
Installation of it went well !
Test it by a command or something?
regards
Jan
When I have use one of the on my RPi 3, how do I check if it works?
Installation of it went well !
Test it by a command or something?
regards
Jan
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Script to restart Domoticz if it crashes
Sudo service domoticz.sh stop
Status
Start
Restart
Status
Start
Restart
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
-
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Script to restart Domoticz if it crashes
I wrote an alternate version:
Notes:
1) The curl command is set to allow unsigned SSL certificates.
2) You need change the service start and stop section of the script to the right name of your Domoticz service.
Eg if you type: "service domoticz stop" and that works on your system then great you got the right name. Some systems may have custom names that people manually specified or could be: "service domoticz.sh stop" as an example.
Code: Select all
#!/bin/bash
while true; do
domoticzcheck=$(curl --max-time 60 -k -s "https://USERNAME:[email protected]/json.htm?type=command¶m=getversion" | grep '"status"' | awk '{ print $3 }' | sed 's/[\,"]//g')
if [[ $domoticzcheck != "OK" ]]; then
echo "Domoticz not running, checking again in 30 seconds."
sleep 30
domoticzcheck=$(curl --max-time 60 -k -s "https://USERNAME:[email protected]/json.htm?type=command¶m=getversion" | grep '"status"' | awk '{ print $3 }' | sed 's/[\,"]//g')
if [[ $domoticzcheck != "OK" ]]; then
echo "Watchguard is restarting Domoticz"
service domoticz stop
service domoticz start
fi
else
echo "Domoticz is running..."
fi
sleep 10
done
1) The curl command is set to allow unsigned SSL certificates.
2) You need change the service start and stop section of the script to the right name of your Domoticz service.
Eg if you type: "service domoticz stop" and that works on your system then great you got the right name. Some systems may have custom names that people manually specified or could be: "service domoticz.sh stop" as an example.
Last edited by ben53252642 on Wednesday 07 February 2018 13:54, edited 1 time in total.
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Script to restart Domoticz if it crashes
mmm please can you tell me the different s between the other?ben53252642 wrote: ↑Wednesday 07 February 2018 1:24 I wrote an alternate version:
Note:Code: Select all
#!/bin/bash while true; do domoticzcheck=$(curl --max-time 60 -k -s "https://USERNAME:[email protected]/json.htm?type=command¶m=getversion" | grep '"status"' | awk '{ print $3 }' | sed 's/[\,"]//g') if [[ $domoticzcheck != "OK" ]]; then echo "Domoticz not running, checking again in 30 seconds." sleep 30 domoticzcheck=$(curl --max-time 60 -k -s "https://USERNAME:[email protected]/json.htm?type=command¶m=getversion" | grep '"status"' | awk '{ print $3 }' | sed 's/[\,"]//g') if [[ $domoticzcheck != "OK" ]]; then echo "Watchguard is restarting Domoticz" service domoticz stop service domoticz start fi else echo "Domoticz is running..." fi sleep 10 done
The curl command is set to allow unsigned SSL certificates.
Where can i place this?
Need a crontab?
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
-
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Script to restart Domoticz if it crashes
The original version may fail to detect if Domoticz is really running in some circumstances due to is simply doing a port check.
The version in my above post makes a request to the Domoticz JSON API and only accepts Domoticz as running if it receives a response which confirms that it "is" actually running AND responding.
If it detects that Domoticz is not running, it waits 30 seconds, checks a second time and if the second attempt fails it then restarts Domoticz.
To use the script:
1) sudo apt-get install screen
2) nano /etc/init.d/watchguard
3) paste the contents below, editing the start section as needed to point to where you saved the watchguard.sh file
4) chmod 755 /etc/init.d/watchguard
5) update-rc.d watchguard defaults
6) reboot the system, then type: screen -x
If you see the watchguard running then you have successfully installed it.
If you need to stop the watchguard for example while updating Domoticz then use:
service watchguard stop
The version in my above post makes a request to the Domoticz JSON API and only accepts Domoticz as running if it receives a response which confirms that it "is" actually running AND responding.
If it detects that Domoticz is not running, it waits 30 seconds, checks a second time and if the second attempt fails it then restarts Domoticz.
To use the script:
1) sudo apt-get install screen
2) nano /etc/init.d/watchguard
3) paste the contents below, editing the start section as needed to point to where you saved the watchguard.sh file
Code: Select all
#!/bin/sh
### BEGIN INIT INFO
# Provides: watchguard
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop:
# Description: Starts Watchguard
### END INIT INFO
case "$1" in
'start')
sudo /usr/bin/screen -S watchguard -d -m sudo /root/scripts/watchguard/watchguard.sh
;;
'stop')
sudo pkill -f "watchguard"
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0
5) update-rc.d watchguard defaults
6) reboot the system, then type: screen -x
If you see the watchguard running then you have successfully installed it.
If you need to stop the watchguard for example while updating Domoticz then use:
service watchguard stop
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
-
- Posts: 843
- Joined: Sunday 23 February 2014 17:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: mixed
- Location: Hengelo(Ov)/NL
- Contact:
Re: Script to restart Domoticz if it crashes
Earlier I reported on some 'difficulties' with the crash-recovery-script.
Sometimes a planned reboot completely fails, and that is easy to see, because Domoticz stops, and the Raspberry needs manual help for restart.
But sometimes the reboot-failure is only 'half' as demonstrated in this graph.
What puzzles, is that the effect is not consistent:
- 3 similar graphs with this kind of layout are generated at one and same Raspberry
Each graph originates from an RRD sh-file which in turn is called by a related lua-script located in /home/pi/domoticz/scripts/lua.
- one graph usually happily continues after the planned periodic reboot
- the other 2 graphs (of which this is one) stop at a reboot and revive at the next reboot
The gap is not predictable and randomly happens.
- the only functional difference is that the 'continuing' graph is coming from 1 rrd-database-file, and that the other 2 graphs come from another rrd-database-file. Those 2 rrd-database-files are maintained by 2 different, but very comparable lua-scripts.
Seems a 'soft, unpredictable' problem, but those are the most difficult to solve .........
Sometimes a planned reboot completely fails, and that is easy to see, because Domoticz stops, and the Raspberry needs manual help for restart.
But sometimes the reboot-failure is only 'half' as demonstrated in this graph.
What puzzles, is that the effect is not consistent:
- 3 similar graphs with this kind of layout are generated at one and same Raspberry
Each graph originates from an RRD sh-file which in turn is called by a related lua-script located in /home/pi/domoticz/scripts/lua.
- one graph usually happily continues after the planned periodic reboot
- the other 2 graphs (of which this is one) stop at a reboot and revive at the next reboot
The gap is not predictable and randomly happens.
- the only functional difference is that the 'continuing' graph is coming from 1 rrd-database-file, and that the other 2 graphs come from another rrd-database-file. Those 2 rrd-database-files are maintained by 2 different, but very comparable lua-scripts.
Seems a 'soft, unpredictable' problem, but those are the most difficult to solve .........
Last edited by Toulon7559 on Saturday 03 October 2020 16:58, edited 1 time in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
-
- Posts: 1
- Joined: Saturday 28 April 2018 15:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Script to restart Domoticz if it crashes
Hi all, I am very new here but have been playing with domoticz for a number of months now.
I noticed a lot of people are stuck on where and how to implement a script to check domoticz.
I have written a little guide on how I have set it up.
Thanks to the handy work of so many people on this forum, it makes life very easy when issues are encountered with domoticz and the domoticz community is around to help.
The script i use is also very simple. I modified the earlier scripts that checks the domoticz state, but I only check if it is NOT equal to active running, therefore, any other state other than "active running" domoticz is restarted. I also get it to restart the homebridge service, as i have found that sometimes it stops responding after domoticz crashes. it obviously isn't a total solution but has been working well for me so far.
if you want to set it up this is how i have implemented it on my pi 3.
The script should work with a standard raspberry pi installation using raspbian.
go into domoticz scripts folder
then make a file called restart_domoticz.sh
copy and paste the script below
save the script by pressing CTRL x and then y and enter
then add execute permission to the script
if all went well you should now be able to test your script by typing
then all that is left to do is add to a cronjob to run every minute.
then add the cronjob at the bottom of the file
save the file by pressing CTRL x and then y and enter.
A big thankyou to everyone who contributed to this idea to keeps domoticz running if or when it fails.
Hopefully, this can help everyone who is having trouble implementing these amazing ideas from the community.
I noticed a lot of people are stuck on where and how to implement a script to check domoticz.
I have written a little guide on how I have set it up.
Thanks to the handy work of so many people on this forum, it makes life very easy when issues are encountered with domoticz and the domoticz community is around to help.
The script i use is also very simple. I modified the earlier scripts that checks the domoticz state, but I only check if it is NOT equal to active running, therefore, any other state other than "active running" domoticz is restarted. I also get it to restart the homebridge service, as i have found that sometimes it stops responding after domoticz crashes. it obviously isn't a total solution but has been working well for me so far.
if you want to set it up this is how i have implemented it on my pi 3.
The script should work with a standard raspberry pi installation using raspbian.
go into domoticz scripts folder
Code: Select all
cd domoticz/scripts
Code: Select all
nano restart_domoticz.sh
Code: Select all
#!/bin/bash
IsDomoticzRunning=`sudo systemctl status domoticz.service`
if [[ $IsDomoticzRunning != *"active (running)"* ]]
then
echo 'Domoticz is not running.Restarting Domoticz.'
sudo systemctl stop domoticz.service
sudo systemctl restart homebridge.service
echo "Domoticz & Homebridge restarted."
else
echo "Domoticz is running. Nothing to do."
fi
then add execute permission to the script
Code: Select all
chmod +x restart_domoticz.sh
Code: Select all
./restart_domoticz.sh
Code: Select all
crontab -e
Code: Select all
*/1 * * * * ./home/pi/domoticz/scripts/restart_domoticz.sh
A big thankyou to everyone who contributed to this idea to keeps domoticz running if or when it fails.
Hopefully, this can help everyone who is having trouble implementing these amazing ideas from the community.
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Script to restart Domoticz if it crashes
A running service doesn’t mean it’s running
-
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Script to restart Domoticz if it crashes
Absolutely correct! You must use an alternate method that tests if the service is actually running.
I wrote a simple bash script here:
viewtopic.php?f=63&t=3016&sid=a4e9c3646 ... 40#p170196
Alternatively use the Monit setup:
https://www.domoticz.com/wiki/Monitorin ... gure_Monit
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
-
- Posts: 66
- Joined: Tuesday 19 April 2016 23:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Script to restart Domoticz if it crashes
Sometimes domoticz is not working, www server of domoticz is not working but systemctl status domoticz shows it as working so you can not check by this way...
Check doing a curl is a better option but you can not use this
domoticzcheck=$(curl --max-time 60 -k -s "https://USERNAME:[email protected]/j ... getversion" | grep '"status"' | awk '{ print $3 }' | sed 's/[\,"]//g')
If you are ussing HTTPS you can not send user passsoword as you are doing... Your script needs pass the info over parameters
Regards!
Check doing a curl is a better option but you can not use this
domoticzcheck=$(curl --max-time 60 -k -s "https://USERNAME:[email protected]/j ... getversion" | grep '"status"' | awk '{ print $3 }' | sed 's/[\,"]//g')
If you are ussing HTTPS you can not send user passsoword as you are doing... Your script needs pass the info over parameters
Regards!
Fronius plugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
-
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Script to restart Domoticz if it crashes
It works fine over HTTPS, make sure your Domoticz is set to use basic auth, I've got at least a dozen scripts working this way.ayasystems wrote: ↑Friday 28 September 2018 14:18 Sometimes domoticz is not working, www server of domoticz is not working but systemctl status domoticz shows it as working so you can not check by this way...
Check doing a curl is a better option but you can not use this
domoticzcheck=$(curl --max-time 60 -k -s "https://USERNAME:[email protected]/j ... getversion" | grep '"status"' | awk '{ print $3 }' | sed 's/[\,"]//g')
If you are ussing HTTPS you can not send user passsoword as you are doing... Your script needs pass the info over parameters
Regards!
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
-
- Posts: 616
- Joined: Thursday 10 November 2016 9:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Script to restart Domoticz if it crashes
Every time Domoticz web server was down but service status still looking OK, a check with httping was enough. As I'm doing the check on the PI running Domoticz itself, I only httping usual HTTP port (not secured one) for port default 8080 on localhost.ayasystems wrote: ↑Friday 28 September 2018 14:18 Check doing a curl is a better option but you can not use this
domoticzcheck=$(curl --max-time 60 -k -s "https://USERNAME:[email protected]/j ... getversion" | grep '"status"' | awk '{ print $3 }' | sed 's/[\,"]//g')
Take care that when Domoticz does not httping anymore, only restarting the Domoticz service is not always successful: Most of the times, web server remains attached to 8080/443 ports & binding fails at restart. As this does not happen very often (once a month maybe), when this happen the monitoring script does a PI reboot.
This is runned every X minutes by a cron. Not at home for now, but if someone finds usefull I could send the script that proved successful (with it's httping timeouts/retry setup before giving up to reboot) for me.
You'll have to install httping before (apt-get install httping).
-
- Posts: 53
- Joined: Saturday 10 March 2018 2:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Script to restart Domoticz if it crashes
lost wrote: ↑Monday 01 October 2018 7:20I would like to see this script ( if you are still active on the forum )ayasystems wrote: ↑Friday 28 September 2018 14:18 <..>
This is runned every X minutes by a cron. Not at home for now, but if someone finds usefull I could send the script that proved successful (with it's httping timeouts/retry setup before giving up to reboot) for me.
<..>
Who is online
Users browsing this forum: No registered users and 0 guests