We're dealing with a (vendor-provided) distributed application, that runs on multiple servers. The servers aren't "equal" -- the main one has to be up and running before the secondary ones can be started.

How can I express this dependency in the secondary.service file? I'd like the following:

  1. At startup, the secondary services on all of the secondary servers wait for the primary service on the primary server to be started. I know, this can be achieved with a custom ExecStartPre -- but, in my opinion, it truly belongs in the After (or Require) clause of the secondary service's [Unit] section. The systemctl utility has the --host option -- is there a similar syntax for referencing remote services inside a .service file?
  2. If/when the primary service is shut down, the secondaries shall all go down too.
  3. Once the primary service is back up, the secondaries shall all start up too.
  4. The previous two can be based on an explicit notification from the primary service, with a periodic check for its health -- to catch the situations, when the primary service is brought down abruptly.

Can any of the above be done using systemd's own mechanisms, or do I need to implement a separate health-monitor service of my own on each secondary server?

We're using RHEL7, where systemd is of a fairly old version 219... Also, if it matters, all of the mentioned services run under systemd --user -- not as "system".


You must log in to answer this question.

Browse other questions tagged .