[systemd-devel] Create a target unit to start & stop a group of services
林自均
johnlinp at gmail.com
Thu Mar 8 10:40:00 UTC 2018
Hi Zbyszek,
Thank you for your explanation.
However, I found that Conflicts= will be a good choice for me:
# /etc/systemd/system/my-apps-start.target
[Unit]
Wants=docker.service sshd.service mongodb.service
# /etc/systemd/system/my-apps-stop.target
[Unit]
Conflicts=docker.service sshd.service mongodb.service
After=docker.service sshd.service mongodb.service
Then
systemctl start my-apps-start.target # starts all my apps
systemctl start my-apps-stop.target # stops all my apps
And both operations are sync, i.e. will wait for all apps to be
started/stopped before systemctl exits.
Thank you all for solving my problems.
John Lin
Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl> 於 2018年3月7日 週三 下午8:48寫道:
> On Tue, Mar 06, 2018 at 03:07:30AM +0000, 林自均 wrote:
> > Anyone?
> >
> > John Lin
> >
> > 林自均 <johnlinp at gmail.com> 於 2018年2月27日 週二 下午6:20寫道:
> >
> > > Hi Jérémy,
> > >
> > > Thank you, but I read the section "Mapping of unit properties to their
> > > inverses" in the man page
> > > https://www.freedesktop.org/software/systemd/man/systemd.unit.html and
> > > then found out the PropagatesReloadTo= and ReloadPropagatedFrom= are
> > > inverses to each other and both can be configured in a unit file. I was
> > > wondering why PartOf= and ConsistsOf= are not the case. Thank you.
>
> No particular reason, just noobody got around to implementing the
> parsing of that option. Shouldn't be too hard though.
>
> Zbyszek
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180308/bf5b7c98/attachment.html>
More information about the systemd-devel
mailing list