Re: [systemd-devel] Having synchronization between 2 process using systemd.

2017-01-20 Thread Mantas Mikul─Śnas
On Fri, Jan 20, 2017 at 12:20 PM, Raghavendra. H. R 
wrote:

> 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
features:

* 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 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Having synchronization between 2 process using systemd.

2017-01-20 Thread Reindl Harald



Am 20.01.2017 um 11:20 schrieb Raghavendra. H. R:

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.


Kindly share some needful inputs whether it is possible in systemd.

We dont want to get add delay in any process


when each of them talks to the other you need to solve that in the 
services itself because it would be a cyclic dependency and so what can 
systemd more do than fire up the services?


your service needs a loop in the client which tries to connect until it 
was successful




___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel