Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

创建 systemctl 服务 #3

Open
Ecss11 opened this issue Mar 9, 2022 · 0 comments
Open

创建 systemctl 服务 #3

Ecss11 opened this issue Mar 9, 2022 · 0 comments
Labels
案例 学习过程的实战经验

Comments

@Ecss11
Copy link
Owner

Ecss11 commented Mar 9, 2022

描述

在某些情况下,如需要部署一个可持久运行的服务时,可以创建 systemctl 实现自动登录,和便捷的启动和关闭。

实现案例

首先找到服务文件的存储路径,并创建一个服务文件 [服务名称].service

systemd 服务文件可以保存到多个不同的目录,我个人偏向保存在 /usr/lib/systemd/system/ 目录中。

5/3/2022 修改:现在默认写到 /etc/systemmd/system/ 目录

[Unit]
Description=A simple program

[Service]
ExecStart=/PATH_TO_PROGRAM/example

待施工。。。

@Ecss11 Ecss11 added 笔记 在项目前的学习资料 案例 学习过程的实战经验 and removed 笔记 在项目前的学习资料 labels May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
案例 学习过程的实战经验
Projects
None yet
Development

No branches or pull requests

1 participant