If the power of the raspberry has been off, it takes more than half an hour before domoticz is restarted. This happens after the script has performed the reboot.
I'm using these lines:
check process domoticz with pidfile /var/run/domoticz.pid
start program = "/etc/init.d/domoticz.sh start"
stop program = "/etc/init.d/domoticz.sh stop"
if failed
host 127.0.0.1 port 8080 protocol http
and request "/json.htm?type=command¶m=getversion"
and content = '"status" : "OK"'
for 3 cycles
then restart
if 5 restarts within 5 cycles then exec "/sbin/reboot"
It looks like the "if failed" part is not working correctly.
When I check the Monit web page, I get the following error:
After more than half an hour, the raspberry has been rebooted based on the "If 5..." statement and then after 5 minutes the domoticz server is finally started.
What is wrong in the "if failed..." statement and how can I test this on the raspberry (terminal).
Monit works partially
Moderators: leecollings, remb0
-
- Posts: 536
- Joined: Monday 20 March 2023 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Somewhere in NL
- Contact:
Re: Monit works partially
I don't understand the "it takes more than half an hour before domoticz is restarted"
I suppose the script "/etc/init.d/domoticz.sh" is present, which should start domoticz right after the boot.
The default monit install has a 'start' delay of 60 or more seconds before it starts checking.
After that delay domoticz should already be up and responding to monit requests.
And beter change
in
I suppose the script "/etc/init.d/domoticz.sh" is present, which should start domoticz right after the boot.
The default monit install has a 'start' delay of 60 or more seconds before it starts checking.
After that delay domoticz should already be up and responding to monit requests.
And beter change
Code: Select all
start program = "/etc/init.d/domoticz.sh start"
Code: Select all
start program = "/etc/init.d/domoticz.sh restart"
Logic will get you from A to B. Imagination will take you everywhere.
-
- Posts: 13
- Joined: Wednesday 01 March 2017 13:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Monit works partially
It surely helped a lot changing from start to restart.
There is still a difference between a reboot command and a power failure. After a reboot command domoticz is running, after a power failure domoticz is started, but not running:
pi@raspberrypi:~ $ sudo service domoticz status
● domoticz.service - LSB: Home Automation System
Loaded: loaded (/etc/init.d/domoticz.sh; generated)
Active: active (exited) since Sat 2024-08-31 10:17:16 CEST; 7min ago
Also the pidfile at /var/run/domoticz.pid is not available
After 5 minutes Moni becomes active and now restarts domoticz. Domoticz is now running again:
pi@raspberrypi:~ $ sudo service domoticz status
● domoticz.service - LSB: Home Automation System
Loaded: loaded (/etc/init.d/domoticz.sh; generated)
Active: active (running) since Sat 2024-08-31 10:27:08 CEST; 1min 7s ago
So, I still need Moni to activate domoticz, but with the restart option (instead of start) it now takes 5 minutes after the boot when Moni starts who checks for the missing pidfile and restarts domoticz. After the restart domoticz is active and running. In the previous situation I had to wait more than 30 minutes for the reboot command to kick in.
There is still a difference between a reboot command and a power failure. After a reboot command domoticz is running, after a power failure domoticz is started, but not running:
pi@raspberrypi:~ $ sudo service domoticz status
● domoticz.service - LSB: Home Automation System
Loaded: loaded (/etc/init.d/domoticz.sh; generated)
Active: active (exited) since Sat 2024-08-31 10:17:16 CEST; 7min ago
Also the pidfile at /var/run/domoticz.pid is not available
After 5 minutes Moni becomes active and now restarts domoticz. Domoticz is now running again:
pi@raspberrypi:~ $ sudo service domoticz status
● domoticz.service - LSB: Home Automation System
Loaded: loaded (/etc/init.d/domoticz.sh; generated)
Active: active (running) since Sat 2024-08-31 10:27:08 CEST; 1min 7s ago
So, I still need Moni to activate domoticz, but with the restart option (instead of start) it now takes 5 minutes after the boot when Moni starts who checks for the missing pidfile and restarts domoticz. After the restart domoticz is active and running. In the previous situation I had to wait more than 30 minutes for the reboot command to kick in.
-
- Posts: 536
- Joined: Monday 20 March 2023 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Somewhere in NL
- Contact:
Re: Monit works partially
Then there is something wrong with your system.
In both case (reboot / power failure) Domoticz should start directly after the system is started up.
B.t.w. I use a start delay of 60 seconds for Monit to do its job.
In both case (reboot / power failure) Domoticz should start directly after the system is started up.
B.t.w. I use a start delay of 60 seconds for Monit to do its job.
Logic will get you from A to B. Imagination will take you everywhere.
-
- Posts: 13
- Joined: Wednesday 01 March 2017 13:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Monit works partially
It looks like it starts after a power failure, but than exits. When I check there is no pidfile.
What can I do or check, to make sure that it starts correctly?
What can I do or check, to make sure that it starts correctly?
-
- Posts: 536
- Joined: Monday 20 March 2023 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Somewhere in NL
- Contact:
Re: Monit works partially
Put on complete debug logging and simulate power failure. See wiki for howto.
In that logging should be a cause.
Post (partial) logging here as attachment or spoiler.
Don't forget to put normal logging back.
In that logging should be a cause.
Post (partial) logging here as attachment or spoiler.
Don't forget to put normal logging back.
Logic will get you from A to B. Imagination will take you everywhere.
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Monit works partially
What version of Domoticz are you using? The issue that Domoticz stops right after a cold reboot (power off) because of the time difference should be fixed in recent versions.
Another option is to have a extra Domoticz startup delay parameter on your environment so it will be sure the time has been synced before Domoticz is started. See for more info wiki page https://www.domoticz.com/wiki/Troublesh ... _cold_boot
Another option is to have a extra Domoticz startup delay parameter on your environment so it will be sure the time has been synced before Domoticz is started. See for more info wiki page https://www.domoticz.com/wiki/Troublesh ... _cold_boot
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 13
- Joined: Wednesday 01 March 2017 13:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Monit works partially
Updating to the latest version solved the problem. I tested this several times. Now domoticz starts right after the power has been restored.
Thanks for all the advices.
Thanks for all the advices.
Who is online
Users browsing this forum: No registered users and 1 guest