如何告诉systemd对实例列表中的任何实例之一满足要求?
假设我有一个名为main_target.target的目标和一个名为serv @ .service的服务模板.在正常操作期间,存在的serv @ .service的唯一实例是:
> serv @ ex1
> serv @ ex2
> serv @ ex3
在任何给定时间只存在其中一个实例,并且我想告诉main_target.target,只要存在三个实例中的任何一个,它就会满足.
直观地说,我想要类似于SMF的require_any标签,但我无法在任何系统文档中找到类似的东西.
注1:我知道我可以创建serv @ ex1,serv @ ex2,serv @ ex3并与Conflicts =指令互斥.
注2:我也知道我可以使用Before =和After =指令将三个实例分层以按特定顺序启动.
解决方法:
如您所述,您可以使用Conflicts =指令使服务互斥. systemd目标只是一种将单元组合在一起的方法,它们没有复杂的依赖选项.
A unit configuration file whose name ends in “.target” encodes information about a target unit of systemd, which is used for grouping units and as well-known synchronization points during start-up.
This unit type has no specific options. See systemd.unit(5) for the common options of all unit configuration files. The common configuration items are configured in the generic [Unit] and [Install] sections. A separate [Target] section does not exist, since no target-specific options may be configured.
systemd.unit供参考.
您只能使用systemd.unit中包含的指令,并且它不包含仅启动多个服务之一的方法.
原文地址:https://codeday.me/bug/20190813/1650141.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。