目录
linux systemctl删除失效的服务单元
应用场景
mysql服务原生方式安装的,但是把对应的安装目录删除后,使用systemctl status mysqld依然可以看到mysql的状态,需要从服务列表中删除
操作命令
//移除服务
systemctl reset-failed mysqld
//查看服务状态,可以发现不能使用,移除成功了
systemctl status mysqld
//查找所有或者某个服务
systemctl list-units --type=service | grep network
//列出所有可用单元
systemctl list-unit-files
//列出所有运行中单元
systemctl list-units
//列出所有失败单元
systemctl --failed
//使用systemctl命令杀死服务
systemctl kill mysqld
//列出所有系统挂载点
systemctl list-unit-files --type=mount
//挂载、卸载、重新挂载、重载系统挂载点并检查系统中挂载点状态
systemctl start tmp.mount
systemctl stop tmp.mount
systemctl restart tmp.mount
systemctl reload tmp.mount
systemctl status tmp.mount
//启动服务
systemctl start mysqld
//停止服务
systemctl stop mysqld
//开机自启
systemctl enable mysqld
//开机关闭
systemctl disable mysqld