[systemd-devel] type=notify not working as intended

Kalpa Gunarathna kalpa at sigscale.com
Tue Aug 15 03:59:54 UTC 2017


Hello all,

I have scripted a service unit as follow.

[Unit]
Description="A test service"
After=epmd.service epmd.socket

[Service]
ExecStart=/home/otpuser/bin/start
Type=notify
NotifyAccess=all
WorkingDirectory=~
User=otpuser
Group=otp
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target


ExecStart directs to a shell script which starts a Erlang run_erl daemon.
This daemon is forking a process which is the BEAM virtual machine. In the
forked process Im sending "READY=1\nSTATUS=Initialized\nMAINPID="
<<Forked-Process-Pid>> "\n to systemd via sd_notify. The problem is service
is getting restarted constantly.

journalctl give this

abc.service: Service hold-off time over, scheduling restart.
Stopped "A test service.".


Is it required to send READY=1 from the daemon it self ? or can systemd
allow forked process of the daemon to send REDAY=1 notification?

It works when Type=forking and PIDFile is specified, but can we have
Type=forking and without PIDFIle, notify READY=1 via forked process ?

My systemd version

$ systemd --version
systemd 229
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170815/6b1b80f8/attachment.html>


More information about the systemd-devel mailing list