首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >systemd在oneshot服务之后执行

systemd在oneshot服务之后执行
EN

Stack Overflow用户
提问于 2017-04-14 07:41:57
回答 1查看 1.5K关注 0票数 2

Hi可以在"oneshot“类型的服务之后运行服务吗

我想运行一个在display-manager.service之前启动但在gpu-manager.service之后启动的脚本,gpu-manager.service是一个检测可用gpu的oneshot服务。这是我的服务:

代码语言:javascript
复制
[Unit]
After=gpu-manager.service
Before=display-manager.service

[Service]
Type=oneshot
ExecStart=myscript

[Install]
WantedBy=multi-user.target

我的服务会在gpu管理器之后和显示开始之前启动吗?

EN

回答 1

Stack Overflow用户

发布于 2017-07-08 18:43:24

您确定需要3个服务吗?

您可以使用ExecStop or other指令运行多个脚本并使用1个systemd服务。

Try this solution

代码语言:javascript
复制
[Unit]
Description=example

[Service]
Type=oneshot
ExecStart=/usr/local/bin/on_start.sh
RemainAfterExit=true
ExecStop=/usr/local/bin/with_stopped.sh

[Install]
WantedBy=graphical.target
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43403283

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档