I'm trying to execute a daemon program from a systemd service, however when I start the script from a command prompt, either manually (systemctl start) or as part of the debian installation (dpkg -i myapp.deb) the command execution does not return back to the command prompt.
[Unit]
Description=MyDaemon
After=NetworkManager.service
[Service]
WorkingDirectory=/usr/local/bin/my-daemon
ExecStart=/usr/local/bin/my-daemon/my-daemon
Type=forking
[Install]
WantedBy=default.target
I can confirm that executed daemon program itself does not 'return', since it is a daemon. Also, when I reboot the system, the service runs the daemon successfully.
I was expecting, however, when starting the service from 'systemctl start', that the service would run the daemon in the background, and return back to the command prompt, especially after specifying 'Type=forking'. I have also tried setting 'Type=Simple' but the outcome is the same.
I've looked at What are ways of creating a daemon using systemd? and Systemd service runs without exiting but neither of these solve my problem.
If someone could help, this would be great.
Thanks.