On Fri, Jan 20, 2017 at 12:20 PM, Raghavendra. H. R <raghuh...@gmail.com>

> Hi All,
> I have a scenario in which I have 2 processes and both acts as Server &
> Client.
> Process A starts it server & tries to connect as client with Process B.
> Process B starts it server & tries to connect as client with Process A.
> We want handle this kind of scenario with the help of systemd sd_notify or
> with the help of runlevels or any other mechanism.

Overall, such mutual dependencies seem a bit odd...

Socket activation (systemd.socket) might work here:

* process A tries to connect to B's socket
* kernel queues the connection while B starts
* process B accepts waiting connection on the inherited socket
* process B tries to connect to A's socket
* A is already started, accepts connection

Another option would be to have the processes notify each other once
they're "ready", e.g. by sending D-Bus signals or using some POSIX IPC

* both processes start independently
* both processes set up a listening socket, broadcast a ready signal over
D-Bus, and wait for another process' ready signal
* process B receives A's signal and connects to A
* process A receives B's signal and connects to B

Mantas Mikulėnas <graw...@gmail.com>
systemd-devel mailing list

Reply via email to