关于centos服务的命令经常会遇到这几种
service
systemctl
/etc/init.d/

service是一个脚本命令,分析service可知是去/etc/init.d目录下执行相关程序。service和chkconfig结合使用。
服务配置文件存放目录/etc/init.d/

命令使用:

service start nginx  
/etc/init.d/nginx  restart  

2 systemctl

centos7 上面启动服务以及关闭服务已经不是以前的service stop/start xxxx了而是systemctl命令,不过用service他会有一个提醒你用systemctl,所以大可不必担心。

列出正在运行的服务状态——systemctl

启动一个服务——systemctl start postfix.service

关闭一个服务——systemctl stop postfix.service

重启一个服务:——systemctl restart postfix.service

显示一个服务的状态——systemctl status postfix.service

在开机时启用一个服务——systemctl enable postfix.service

在开机时禁用一个服务——systemctl disable postfix.service

查看服务是否开机启动——systemctl is-enabled postfix.service;echo $?

查看已启动的服务列表——systemctl list-unit-files|grep enabled

相关文章:

  • 2022-01-11
  • 2022-02-11
  • 2021-10-14
  • 2022-02-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2021-03-31
相关资源
相似解决方案