Init script of community/domoticz package fails to properly start domoticz
When trying to start the domoticz daemon via the init script, it immediately crashes. This is caused by the PID file, which both the domoticz process (due to the explicit -daemon
and -pidfile
arguments) as well as start-stop-daemon (due to command_background=YES
) try to create. Since start-stop-daemon creates the PID file as root, the domoticz process is unable to overwrite the file (which it probably shouldn't do anyway) and then immediately terminates.
Changing the command_args
line in /etc/init.d/domoticz
from
command_args="-daemon -userdata $userdata -approot $approot -pidfile $pidfile $daemon_args"
to
command_args="-userdata $userdata -approot $approot $daemon_args"
fixes the issue.
Changing command_background
to false
instead, does not seem to work, because the PID file created by domoticz has its read permissions set to allow only the owner to read it, so that start-stop-daemon does not recognize it as running.