[systemd-devel] Query regarding NOTIFY_SOCKET

Michael Chapman mike at very.puzzling.org
Tue Nov 8 15:05:29 UTC 2016


On Tue, 8 Nov 2016, Raghavendra. H. R wrote:
> Does it mean that only services can notify systemd about their readiness
> and systemd will not notify another service.

The "notify" in Type=notify has nothing to do with notifications *between* 
units.

The Type= directive's only purpose is to tell systemd what to look for to 
know whether the service has completed startup -- that is, the condition 
which causes the service to transition from an "activating" state to an 
"active" state. Type=notify means "the service has completed startup when 
the service has called sd_notify with READY=1".

If you want one service's startup to cause another service to start, then 
you need some kind of dependency between them. In particular, if you want 
second.service to be automatically started whenever one.service is 
started, then you probably want to set up a Wants= or Requires= 
relationship. See the systemd.unit(5) manpage for details on these 
directives.

Note that it is perfectly fine for one.service to have 
Wants=second.service (that is, "whenever one.service is started, try to 
also start second.service") even though second.service is 
After=one.service (i.e. "whenever one.service and second.service are being 
started together, ensure second.service is only started after one.service 
has reached the 'active' state"). Requirement dependencies 
(Wants/Requires/etc.) and ordering dependencies (After/Before) are largely 
orthogonal.

I should add though if you just want these two services to be started 
together at boot, then the [Install] section you've got there is 
sufficient. When both those services are enabled, the multi-user.target 
will have a Wants= relationship with both the services -- that is, in 
order to start multi-user.target systemd knows it also needs to start 
one.service and second.service.

Hope this clears a few things up.

- Michael


More information about the systemd-devel mailing list