Cannot start the domoticz daemon in systemd but can be started in terminal

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

Moderator: leecollings

Post Reply
cmisip
Posts: 7
Joined: Sunday 22 February 2026 8:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Cannot start the domoticz daemon in systemd but can be started in terminal

Post by cmisip »

The systemd script in /etc/systemd/system is:

Code: Select all

[Unit]
Description=Domoticz Home Automation Service
After=network-online.target

[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/home/pi/domoticz
ExecStart=/home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443 -pidfile /var/run/domoticz/domoticz.pid
Restart=on-failure

[Install]
WantedBy=multi-user.target
The result of starting the systemd script:

Code: Select all

domoticz.service - Domoticz Home Automation Service
     Loaded: loaded (/etc/systemd/system/domoticz.service; enabled; preset: enabled)
     Active: inactive (dead) since Sun 2026-02-22 14:10:25 GMT; 5min ago
   Duration: 191ms
 Invocation: 25c5fb4ab80c413489635312fe0ac205
    Process: 1079 ExecStart=/home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443 -pidfile /var/run/domoticz/domoticz.pid (code=exited>
   Main PID: 1079 (code=exited, status=0/SUCCESS)
        CPU: 545ms

Feb 22 14:10:23 rpidhcpserver systemd[1]: Started domoticz.service - Domoticz Home Automation Service.
Feb 22 14:10:23 rpidhcpserver domoticz[1079]: 2026-02-22 14:10:23.847  Status: Domoticz V2025.2 (c)2012-2025 GizMoCuz
Feb 22 14:10:23 rpidhcpserver domoticz[1079]: 2026-02-22 14:10:23.847  Status: Build Hash: e63981b18, Date: 2025-10-13 10:42:57
Feb 22 14:10:23 rpidhcpserver domoticz[1079]: 2026-02-22 14:10:23.847  Status: Startup Path: /home/pi/domoticz/
Feb 22 14:10:23 rpidhcpserver domoticz[1079]: domoticz: Domoticz is starting up....
Feb 22 14:10:23 rpidhcpserver domoticz[1079]: Domoticz is starting up....
Feb 22 14:10:23 rpidhcpserver domoticz[1080]: Domoticz is exiting...
Feb 22 14:10:25 rpidhcpserver systemd[1]: domoticz.service: Deactivated successfully.
If I run the execstart code in the command line, the domoticz daemon is created. Why can't systemd do the same?

Code: Select all

home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443 -pidfile /var/run/domoticz/domoticz.pid
Result of running in commandline as user pi:

Code: Select all

pi@rpidhcpserver:~/domoticz $ /home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443 -pidfile /var/run/domoticz/domoticz.pid
2026-02-22 14:17:42.839  Status: Domoticz V2025.2 (c)2012-2025 GizMoCuz
2026-02-22 14:17:42.839  Status: Build Hash: e63981b18, Date: 2025-10-13 10:42:57
2026-02-22 14:17:42.839  Status: Startup Path: /home/pi/domoticz/
domoticz: Domoticz is starting up....
I did use systemd tmpfiles.d to create /run/domoticz. /etc/tmpfiles.d/domoticz.conf contains

Code: Select all

#Type Path        Mode UID        GID        Age Argument
d     /run/domoticz 0755 pi     pi     -   -
Thanks,
Chris
cmisip
Posts: 7
Joined: Sunday 22 February 2026 8:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cannot start the domoticz daemon in systemd but can be started in terminal

Post by cmisip »

I think I figure it out. Type has to be oneshot and RemainAfterExit=yes so ExecStop is not called immediately.

Code: Select all

[Unit]
Description=Domoticz Home Automation Service
After=network-online.target

[Service]
Type=oneshot
User=pi
Group=pi
WorkingDirectory=/home/pi/domoticz
ExecStart=/home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 4443 -pidfile /var/run/domoticz/domoticz.pid
RemainAfterExit=yes
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
From this forum message:

https://forums.raspberrypi.com/viewtopic.php?t=196871
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest