Domoticz does not restart after being killed on Raspbian (stretch)

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
User avatar
kraades
Posts: 36
Joined: Wednesday 24 June 2015 9:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Domoticz does not restart after being killed on Raspbian (stretch)

Post by kraades »

Clean install of Domoticz V4.9700 on Raspbian Stretch Lite on Raspberry Pi 2.
No Domoticz database restored.

It seems that Domoticz does not restart after being killed with a kill command on Raspbian (stretch).
After starting Domoticz the status is "active (exited)" instead of "active (running)" as it should be.
After rebooting the system Domoticz can be started again.
See below.

For reference.
This does work on Raspbian (wheezy).
See below.

Is this a bug?

Successful Domoticz restart on Raspbian (stretch):

Code: Select all

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

pi@raspberrypi:~ $ sudo /etc/init.d/domoticz.sh status
● domoticz.service - LSB: Home Automation System
   Loaded: loaded (/etc/init.d/domoticz.sh; generated; vendor preset: enabled)
   Active: active (running) since Wed 2019-01-09 15:36:59 CET; 5min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 360 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/domoticz.service
           └─367 /home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443

Jan 09 15:36:58 raspberrypi systemd[1]: Starting LSB: Home Automation System...
Jan 09 15:36:59 raspberrypi domoticz.sh[360]: 2019-01-09 15:36:59.300  Status: Domoticz V4.9700 (c)2012-2018 GizMoCuz
Jan 09 15:36:59 raspberrypi domoticz.sh[360]: 2019-01-09 15:36:59.308  Status: Build Hash: a3a45906, Date: 2018-06-23 16:24:51
Jan 09 15:36:59 raspberrypi domoticz.sh[360]: 2019-01-09 15:36:59.317  Status: Startup Path: /home/pi/domoticz/
Jan 09 15:36:59 raspberrypi domoticz.sh[360]: domoticz: Domoticz is starting up....
Jan 09 15:36:59 raspberrypi domoticz[366]: Domoticz is starting up....
Jan 09 15:36:59 raspberrypi domoticz[367]: Domoticz running...
Jan 09 15:36:59 raspberrypi systemd[1]: Started LSB: Home Automation System.
pi@raspberrypi:~ $ sudo /etc/init.d/domoticz.sh stop
[ ok ] Stopping domoticz.sh (via systemctl): domoticz.service.
pi@raspberrypi:~ $ sudo  /etc/init.d/domoticz.sh status
● domoticz.service - LSB: Home Automation System
   Loaded: loaded (/etc/init.d/domoticz.sh; generated; vendor preset: enabled)
   Active: inactive (dead) since Wed 2019-01-09 15:43:10 CET; 9s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 531 ExecStop=/etc/init.d/domoticz.sh stop (code=exited, status=0/SUCCESS)
  Process: 360 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)

Jan 09 15:36:59 raspberrypi domoticz.sh[360]: 2019-01-09 15:36:59.308  Status: Build Hash: a3a45906, Date: 2018-06-23 16:24:51
Jan 09 15:36:59 raspberrypi domoticz.sh[360]: 2019-01-09 15:36:59.317  Status: Startup Path: /home/pi/domoticz/
Jan 09 15:36:59 raspberrypi domoticz.sh[360]: domoticz: Domoticz is starting up....
Jan 09 15:36:59 raspberrypi domoticz[366]: Domoticz is starting up....
Jan 09 15:36:59 raspberrypi domoticz[367]: Domoticz running...
Jan 09 15:36:59 raspberrypi systemd[1]: Started LSB: Home Automation System.
Jan 09 15:43:08 raspberrypi systemd[1]: Stopping LSB: Home Automation System...
Jan 09 15:43:08 raspberrypi domoticz[367]: Domoticz is exiting...
Jan 09 15:43:10 raspberrypi domoticz[367]: Domoticz stopped...
Jan 09 15:43:10 raspberrypi systemd[1]: Stopped LSB: Home Automation System.
pi@raspberrypi:~ $ sudo /etc/init.d/domoticz.sh start
[ ok ] Starting domoticz.sh (via systemctl): domoticz.service.
pi@raspberrypi:~ $ sudo /etc/init.d/domoticz.sh status
● domoticz.service - LSB: Home Automation System
   Loaded: loaded (/etc/init.d/domoticz.sh; generated; vendor preset: enabled)
   Active: active (running) since Wed 2019-01-09 15:43:22 CET; 10s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 531 ExecStop=/etc/init.d/domoticz.sh stop (code=exited, status=0/SUCCESS)
  Process: 587 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/domoticz.service
           └─594 /home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443

Jan 09 15:43:22 raspberrypi systemd[1]: Starting LSB: Home Automation System...
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: 2019-01-09 15:43:22.826  Status: Domoticz V4.9700 (c)2012-2018 GizMoCuz
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: 2019-01-09 15:43:22.827  Status: Build Hash: a3a45906, Date: 2018-06-23 16:24:51
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: 2019-01-09 15:43:22.828  Status: Startup Path: /home/pi/domoticz/
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: domoticz: Domoticz is starting up....
Jan 09 15:43:22 raspberrypi domoticz[594]: Domoticz running...
Jan 09 15:43:22 raspberrypi systemd[1]: Started LSB: Home Automation System.
Unsuccessful Domoticz restart on Raspbian (stretch) using kill command:

Code: Select all

pi@raspberrypi:~ $ ps -ef | grep domo
root       594     1  0 15:43 ?        00:00:00 /home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443
pi         660   466  0 15:43 pts/0    00:00:00 grep --color=auto domo
pi@raspberrypi:~ $ sudo kill 594
pi@raspberrypi:~ $ sudo /etc/init.d/domoticz.sh status
● domoticz.service - LSB: Home Automation System
   Loaded: loaded (/etc/init.d/domoticz.sh; generated; vendor preset: enabled)
   Active: active (exited) since Wed 2019-01-09 15:43:22 CET; 35s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 531 ExecStop=/etc/init.d/domoticz.sh stop (code=exited, status=0/SUCCESS)
  Process: 587 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)

Jan 09 15:43:22 raspberrypi systemd[1]: Starting LSB: Home Automation System...
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: 2019-01-09 15:43:22.826  Status: Domoticz V4.9700 (c)2012-2018 GizMoCuz
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: 2019-01-09 15:43:22.827  Status: Build Hash: a3a45906, Date: 2018-06-23 16:24:51
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: 2019-01-09 15:43:22.828  Status: Startup Path: /home/pi/domoticz/
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: domoticz: Domoticz is starting up....
Jan 09 15:43:22 raspberrypi domoticz[594]: Domoticz running...
Jan 09 15:43:22 raspberrypi systemd[1]: Started LSB: Home Automation System.
Jan 09 15:43:50 raspberrypi domoticz[594]: Domoticz is exiting...
Jan 09 15:43:53 raspberrypi domoticz[594]: Domoticz stopped...
pi@raspberrypi:~ $ sudo /etc/init.d/domoticz.sh start
[ ok ] Starting domoticz.sh (via systemctl): domoticz.service.
pi@raspberrypi:~ $ ps -ef | grep domo
pi         726   466  0 15:44 pts/0    00:00:00 grep --color=auto domo
pi@raspberrypi:~ $ sudo  /etc/init.d/domoticz.sh status
● domoticz.service - LSB: Home Automation System
   Loaded: loaded (/etc/init.d/domoticz.sh; generated; vendor preset: enabled)
   Active: active (exited) since Wed 2019-01-09 15:43:22 CET; 1min 12s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 531 ExecStop=/etc/init.d/domoticz.sh stop (code=exited, status=0/SUCCESS)
  Process: 587 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)

Jan 09 15:43:22 raspberrypi systemd[1]: Starting LSB: Home Automation System...
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: 2019-01-09 15:43:22.826  Status: Domoticz V4.9700 (c)2012-2018 GizMoCuz
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: 2019-01-09 15:43:22.827  Status: Build Hash: a3a45906, Date: 2018-06-23 16:24:51
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: 2019-01-09 15:43:22.828  Status: Startup Path: /home/pi/domoticz/
Jan 09 15:43:22 raspberrypi domoticz.sh[587]: domoticz: Domoticz is starting up....
Jan 09 15:43:22 raspberrypi domoticz[594]: Domoticz running...
Jan 09 15:43:22 raspberrypi systemd[1]: Started LSB: Home Automation System.
Jan 09 15:43:50 raspberrypi domoticz[594]: Domoticz is exiting...
Jan 09 15:43:53 raspberrypi domoticz[594]: Domoticz stopped...
pi@raspberrypi:~ $
Successful Domoticz restart on Raspbian (wheezy):

Code: Select all

pi@raspberrypi ~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@raspberrypi ~ $ sudo /etc/init.d/domoticz.sh status
[ ok ] domoticz is running.
pi@raspberrypi ~ $ sudo /etc/init.d/domoticz.sh stop
pi@raspberrypi ~ $ sudo /etc/init.d/domoticz.sh status
[FAIL] domoticz is not running ... failed!
pi@raspberrypi ~ $ sudo /etc/init.d/domoticz.sh start
2019-01-09 15:57:57.612  Status: Domoticz V4.9700 (c)2012-2018 GizMoCuz
2019-01-09 15:57:57.612  Status: Build Hash: a3a45906, Date: 2018-06-23 16:24:51
2019-01-09 15:57:57.613  Status: System: Raspberry Pi
2019-01-09 15:57:57.613  Status: Startup Path: /home/pi/domoticz/
domoticz: Domoticz is starting up....
pi@raspberrypi ~ $ sudo /etc/init.d/domoticz.sh status
[ ok ] domoticz is running.
Successful Domoticz restart on Raspbian (wheezy) using kill command:

Code: Select all

pi@raspberrypi ~ $ ps -ef | grep domo
root      5301     1  1 15:57 ?        00:00:00 /home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443
pi        5375  5032  0 15:58 pts/0    00:00:00 grep --color=auto domo
pi@raspberrypi ~ $ sudo kill 5301
pi@raspberrypi ~ $ sudo /etc/init.d/domoticz.sh status
[FAIL] domoticz is not running ... failed!
pi@raspberrypi ~ $ sudo /etc/init.d/domoticz.sh start
2019-01-09 15:58:42.773  Status: Domoticz V4.9700 (c)2012-2018 GizMoCuz
2019-01-09 15:58:42.773  Status: Build Hash: a3a45906, Date: 2018-06-23 16:24:51
2019-01-09 15:58:42.774  Status: System: Raspberry Pi
2019-01-09 15:58:42.774  Status: Startup Path: /home/pi/domoticz/
domoticz: Domoticz is starting up....
pi@raspberrypi ~ $ sudo /etc/init.d/domoticz.sh status
[ ok ] domoticz is running.
pi@raspberrypi ~ $
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Domoticz does not restart after being killed on Raspbian (stretch)

Post by waaren »

kraades wrote: Wednesday 09 January 2019 16:21 It seems that Domoticz does not restart after being killed with a kill command on Raspbian (stretch).
After starting Domoticz the status is "active (exited)" instead of "active (running)" as it should be.
After rebooting the system Domoticz can be started again.
I don't know for previous versions but in stretch I do a manual stop before start when domoticz was killed (by a kill command or crash)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
kraades
Posts: 36
Joined: Wednesday 24 June 2015 9:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Domoticz does not restart after being killed on Raspbian (stretch)

Post by kraades »

waaren wrote: Wednesday 09 January 2019 17:09 I don't know for previous versions but in stretch I do a manual stop before start when domoticz was killed (by a kill command or crash)
Thanks!

Your suggestion to first issue the stop command before the start command does work.
As an alternative it looks like you can also use the restart command.

I do think though that this is a bug because imho Domoticz should be able to start under every circumstance using the start command.

This also means that the Monit configuration needs to change from:
(from https://www.domoticz.com/wiki/Monitorin ... f_programs)

Code: Select all

start program = "/etc/init.d/domoticz.sh start"
stop  program = "/etc/init.d/domoticz.sh stop"
to:

Code: Select all

start program = "/etc/init.d/domoticz.sh restart"
stop  program = "/etc/init.d/domoticz.sh stop"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Domoticz does not restart after being killed on Raspbian (stretch)

Post by waaren »

kraades wrote: Wednesday 09 January 2019 18:59 As an alternative it looks like you can also use the restart command.
You are right. If you look at /etc/init.d/domoticz.sh you will see that the restart is effectively a stop followed by a start.
In my monit I use

Code: Select all

service domoticz restart 
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest