| 启用自启 | systemctl enable xxx |
|---|---|
| 禁用自启 | systemctl disable xxx |
| 立即启用 | systemctl enable --now xxx |
| 状态查询 | systemctl is-enabled xxx(enabled/disabled/static/masked) |
示例
示例
systemctl enable --now nginx
systemctl disable firewalld # 按安全策略谨慎操作
systemctl is-enabled chronyd
systemctl list-unit-files --type=service --state=enabled | head -30static 表示单元没有 [Install] 段、不能直接 enable,通常由其他单元或 target 拉起。