[systemd-devel] Create a target unit to start & stop a group of services

Michal Sekletar msekleta at redhat.com
Mon Feb 26 10:08:50 UTC 2018


On Mon, Feb 26, 2018 at 10:24 AM, 林自均 <johnlinp at gmail.com> wrote:

> However, it is a little bit tedious to write drop-ins for each service
> units. Is there a directive for "my-apps.target" to propagate "stop"
> operation to the 3 services? I was expecting something like
> "PropagateStopTo=docker.service sshd.service mongodb.service".

I agree that preparation steps are tedious for your scenario, but this
is because the original use-case behind PartOf was a bit different. We
needed a way to stop a group of services at the same time. Think about
foo.target and then imagine a lot of instances of foo at .service which
all have PartOf=foo.target (because of configuration in the template
unit file). Previously you couldn't really stop the instances with a
single command.

Unfortunately, we don't have a dependency (AFAIK) that only propagates
stop actions.

Michal


More information about the systemd-devel mailing list