错误提示
解决办法
使用systemctl命令,systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。
据说在CentOS7.0后,不再使用service,而是systemctl 。centos7.0是向下兼容的,也是可以用service
据说许多linux的distributions都已经转投systemd了,而ubuntu自从15.04版本以后都使用了systemd。Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器。
常见常用的命令:
foobar表示伪变量。
- 打开服务:sudo systemctl start foobar
- 关闭服务:sudo systemctl stop foobar
- 重启服务:sudo systemctl restart foobar
- 不中断正常功能下重新加载服务:sudo systemctl reload foobar
- 设置服务的开机自启动:sudo systemctl enable foobar
- 关闭服务的开机自启动:sudo systemctl disable foobar
- 查看活跃的单元:systemctl list-units
- 查看某个服务的状态:systemctl status foobar
- 查看已启动的服务列表: systemctl list-unit-files|grep enabled
- 查看启动失败的服务列表:systemctl --failed
可参考
https://linux.cn/article-10245-1.html
https://linux.cn/article-5926-1.html