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

Colin Guthrie colin at mageia.org
Wed Jan 27 02:13:28 PST 2016


Pathangi Janardhanan wrote on 26/01/16 20:41:
> 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
> 
> 2. Let systemd start service A and B together, and have some specific
> messaging/mechanism from service A and B
> 
>  The third option I was looking for but which I could not find, was to
> 
>  have systemd start both independently, and then have service B
> query/wait on systemd service till service A sends a SD_NOTIFY with
> ready message?
> 
>  is something like that possible, or is option 2 the best way for me to
> proceed?

Option 1 is likely the easiest.

Depending on how the services actually work, then you could just use
socket activation and thus the services only depend on the sockets that
active each service and not the services themselves directly.

e.g. if service A talks to service B via a socket, then just ensure that
service B can be socket activated and then you can technically start
them both in parallel.


Col



-- 

Colin Guthrie
colin(at)mageia.org
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list