目录
[4、重新加载 Systemd 配置](#4、重新加载 Systemd 配置)
1、停止服务
bash
# 停止认证服务
sudo systemctl stop auth.service
# 停止 socket 服务
sudo systemctl stop auth.socket
2、禁用服务(防止开机启动)
bash
sudo systemctl disable auth.service
sudo systemctl disable auth.socket
3、删除服务文件
bash
sudo rm /etc/systemd/system/auth.service
sudo rm /etc/systemd/system/auth.socket
4、重新加载 Systemd 配置
bash
sudo systemctl daemon-reload
sudo systemctl reset-failed
5、验证服务已删除
bash
systemctl status auth.service # 应该显示 "Unit auth.service could not be found"
systemctl status auth.socket # 应该显示 "Unit auth.socket could not be found"
注意事项
服务状态检查:
-
删除前检查服务状态:
systemctl status auth.service
-
删除后验证:
systemctl list-unit-files | grep auth
应该没有输出
依赖关系:
-
如果服务有依赖关系(如定时器、其他服务),也需要一并删除
-
使用
systemctl list-dependencies auth.service
查看依赖
日志清理:
bash
# 清除服务日志
sudo journalctl --vacuum-time=1s --unit=auth.service