[systemd-devel] when is a service ready to be used after startup?

Olaf Hering olaf at aepfle.de
Wed Dec 10 01:32:33 PST 2014


I wonder how systemd handles the startup time of a daemon once it did
the execve (or whatever systemd does internally). Every daemon needs
some time until it can service requests. 

In the following example a socket is provided, a daemon handles the
socket and another tool will use the socket. How can I make sure tool B
will always find an operational socket handled by A? There is the
obvious startup time required within A until it can service requests.

What happens if B runs and tries to acces /path while A is still
starting up?

Olaf

A.socket:
[Unit]
DescriptionA socket
[Socket]
ListenStream=/path
SocketMode=0600
Service=A.service
[Install]
WantedBy=sockets.target


A.service:
[Unit]
Description=A service
Requires=A.socke
[Service]
Type=notify
ExecStart=/bin/A
[Install]
WantedBy=multi-user.target


B.service:
[Unit]
Description=B, a tool talking to A
Requires=A.service
[Service]
Type=oneshot
ExecStart=/bin/B
[Install]
WantedBy=multi-user.target


More information about the systemd-devel mailing list