[systemd-devel] Can one service receive SD_NOTIFY (Ready) message of another service?

Lennart Poettering lennart at poettering.net
Wed Jan 27 04:14:52 PST 2016


On Tue, 26.01.16 15:41, Pathangi Janardhanan (path.jana at gmail.com) wrote:

> Hi All,
> 
>  The use case I have is following:
> 
>  I have a service B, which for its operation depends on Service A. Using
> systemd feature, I can make systemd start service B after service A has
> indicated ready.
> 
>  The issue is service B also does a lot of initialization which is
> independent of service A (which also has length initialization code). After
> that initialization it needs to know of service A availability, before
> service B can declare itself ready.
> 
>  I see two choices:
> 
> 1. Use systemd and have it start service B after service A is fully ready,
> even if that means that the service B intialization is not being done in
> parallel

This is certainly easiest.
> 
> 2. Let systemd start service A and B together, and have some specific
> messaging/mechanism from service A and B

Note that if A would use socket actviation, then this problem wouldn't
exist at all, as B could simply start up when it wants without any
ordering, and would implicitly block on any communication socket until
A is up...

You could also use the bus to watch the state of tha A unit.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list