使用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

相关文章:

  • 2021-12-10
  • 2022-01-16
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2021-07-03
猜你喜欢
  • 2021-05-30
  • 2022-03-06
  • 2021-11-18
  • 2021-12-09
  • 2022-12-23
  • 2021-11-20
  • 2021-11-22
相关资源
相似解决方案