02月13, 2023

systemd 使用

systemd是目前Linux系统上主要的系统守护进程管理工具。Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器。

配置文件

配置文件在/etc/systemd/system未知,以下是clash配置文件。

[Unit]
Description=clash daemon

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/clash -d /etc/clash/
Restart=on-failure

[Install]
WantedBy=multi-user.target

重新加载

systemctl daemon-reload 重新加载系统管理守护进程的配置文件。当systemd配> 置文件修改后,可使用此命令让系统重新加载配置文件。

systemctl reload XXX.service加载某个服务的配置文件。

启动

systemctl start clash

停止

systemctl stop clash

重启

systemctl restart clash

开机启动

systemctl enable clash

查看状态

systemctl status docker.service

查看服务列表

systemctl list-unit-files systemctl list-unit-files --type=service|grep docker

本文链接:https://imyoyo.xyz/post/systemd.html

-- EOF --

Comments