systemctl

最后更新于:2022-04-02 03:48:47

[TOC] ## systemctl ``` systemctl start 启动 systemctl stop 关闭 systemctl restart 重启 systemctl reload 更新配置不重启 systemctl kill 杀死一个服务的所有子进程,当stop 失败 systemctl enable 开启启动 systemctl disable 取消开启启动 systemctl status 服务状态 systemctl is-active 否正在运行 systemctl is-enable 是否开启启动 systemctl cat 获取服务配置文件内容 systemctl show 显示某个 Unit 的所有底层参数 systemctl list-dependencies Unit 依赖关系 systemctl list-unit-files [--type=service] 列出所有配置文件[列出所有服务] systemctl daemon-reload 重新加载配置 ``` ## 示例 ### systemctl list-unit-files --type=service ``` $ systemctl list-unit-files --type=service UNIT FILE STATE auditd.service enabled blk-availability.service disabled brandbot.service static 四种状态 * enabled:已建立启动链接 * disabled:没建立启动链接 * static:该配置文件没有`[Install]`部分(无法执行),只能作为其他配置文件的依赖 * masked:该配置文件被禁止建立启动链接 ```
';