Page 1 of 1

Raspberry second boot after 1 Minute

Posted: Sunday 21 April 2019 9:59
by Jubbes
Hello, if my Raspberry reboots after an unexpected power failure, Domoticz will not start automatically because of a date problem with the Raspberry. Only after a renewed reboot Domoticz then also starts. How can I teach the Raspberry when it boots after about 1 minute to make a sudo reboot?
Many Easter greetings, Jubbes

Re: Raspberry second boot after 1 Minute

Posted: Sunday 21 April 2019 13:00
by waaren
Jubbes wrote: Sunday 21 April 2019 9:59 Hello, if my Raspberry reboots after an unexpected power failure, Domoticz will not start automatically because of a date problem with the Raspberry. Only after a renewed reboot Domoticz then also starts. How can I teach the Raspberry when it boots after about 1 minute to make a sudo reboot?
Can you please elaborate on what the date problem is ? Maybe it can be solved by setting the right time-zone using

Code: Select all

sudo raspi-config 
That will be easier than to create a script that will reboot your raspberry after a recovery from a power failure

Re: Raspberry second boot after 1 Minute

Posted: Sunday 21 April 2019 13:18
by Jubbes
Rasberry starts with a date from 1970 or so and then gets the current date over the Internet. Domoticz does not get along with the year 1970 and stops the starting process. In a sudo reboot but then the current year is read and domoticz can start normally. that's why I would like to start the raspi 2 x so that domoticz started. Under raspi-config everything is set correctly.

Re: Raspberry second boot after 1 Minute

Posted: Sunday 21 April 2019 13:36
by waaren
Jubbes wrote: Sunday 21 April 2019 13:18 Rasberry starts with a date from 1970 or so and then gets the current date over the Internet. Domoticz does not get along with the year 1970 and stops the starting process. In a sudo reboot but then the current year is read and domoticz can start normally. that's why I would like to start the raspi 2 x so that domoticz started. Under raspi-config everything is set correctly.
On raspberry this type of date problems can be prevented by the fake-hwclock package. This package ensure date / time is not to far off even when no access to NTP servers yet.

Code: Select all

sudo apt-get update
sudo apt-get install fake-hwclock

Re: Raspberry second boot after 1 Minute

Posted: Sunday 21 April 2019 13:54
by Jubbes
OK, thanks you. I will test it.

Re: Raspberry second boot after 1 Minute

Posted: Tuesday 23 April 2019 18:45
by zzaal
Hi
I have the same problem
I decided it so

edit the file: etc/rc.local

add two lines to the end of the file

sleep 20
sudo service domoticz.sh restart


where: sleep 20 -delay in seconds

it starts Domoticz again after 20 sec.

here is an example of the finished file:

Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi
sleep 20
sudo service domoticz.sh restart
exit 0 
sorry for my bad english...

Re: Raspberry second boot after 1 Minute

Posted: Saturday 15 January 2022 11:01
by Estebus
waaren wrote: Sunday 21 April 2019 13:36
Jubbes wrote: Sunday 21 April 2019 13:18 Rasberry starts with a date from 1970 or so and then gets the current date over the Internet. Domoticz does not get along with the year 1970 and stops the starting process. In a sudo reboot but then the current year is read and domoticz can start normally. that's why I would like to start the raspi 2 x so that domoticz started. Under raspi-config everything is set correctly.
On raspberry this type of date problems can be prevented by the fake-hwclock package. This package ensure date / time is not to far off even when no access to NTP servers yet.

Code: Select all

sudo apt-get update
sudo apt-get install fake-hwclock
In my case this problem was in lot of situation. Only solution was to restart the domoticz service after each reboot.

Thanks a lot for this solution. fake-hwclock was already installed for me but, by default, make a save each hours, that was not enough. I added a bash for cron in order to force a save each 5 secondes and i don't have problem anymore.

Br,

Re: Raspberry second boot after 1 Minute

Posted: Saturday 15 January 2022 17:31
by waltervl
Just for the reference, some more options to get over the Domoticz crash after a cold boot can be found in the wiki:
https://www.domoticz.com/wiki/Troublesh ... _cold_boot