首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何通过OpenRC创建/使用服务?

如何通过OpenRC创建/使用服务?
EN

Stack Overflow用户
提问于 2021-01-29 01:51:40
回答 1查看 781关注 0票数 0

我习惯于使用systemd创建和使用服务,就像这样:

XXXX.service:

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

[Service]
Type=Simple
ExecStart=/path/to/my/script.sh

XXXX.timer:

代码语言:javascript
复制
[Unit]
Description=Timer for Report Service

[Timer]
OnCalendar=*-*-* 2:00:00
Persistent=true

[Install]
WantedBy=timers.target

但是现在,我不得不使用OpenRC,我真的不明白它是如何工作的!

有人解释了OpenRC是如何工作的,并根据我的例子,如何使用OpenRC创建服务,以便学习如何使用它?

非常感谢!

EN

回答 1

Stack Overflow用户

发布于 2021-02-16 04:51:11

也许学习this是最好的选择。

基本脚本如下所示:

代码语言:javascript
复制
#!/sbin/openrc-run
# Copyright 2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

name="service"
description=""
command="/path/to/dir/"
command_args="${service_args}"
#command_user="user:user"

depend() {

}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65942607

复制
相关文章

相似问题

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