systemd 清理不必要的service

执行systemctl status时,发现如下输出:

➔ systemctl status
● hostname
    State: degraded
     Jobs: 0 queued
   Failed: 1 units
    Since: Tue 2018-10-30 06:51:31 CST; 1 years 9 months ago
   CGroup: /
           ├─1 /usr/lib/systemd/systemd --system --deserialize 21

state的状态是degraded,查了一下发现是由于我的nginx service未启动,因为前几天手动编译安装了nginx,并且新建了一个nginx@1.18.service,所以这个service其实没用到了,把它清理掉吧:

systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
rm /etc/systemd/system/[servicename] # and symlinks that might be related
rm /usr/lib/systemd/system/[servicename] 
rm /usr/lib/systemd/system/[servicename] # and symlinks that might be related
systemctl daemon-reload
systemctl reset-failed

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注