对比centos7的systemctl和其他service+chkconfig

syetemctl就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了。
systemctl 是系统服务管理器命令,它实际上将 service 和 chkconfig 这两个命令组合到一起。

(一)对比

任务 旧指令(centos6、5) 新指令(centos7)
显示所有已启动的服务 chkconfig --list systemctl list-units --type=service
--all查看所有服务:
systemctl list-units --type=service --all
使某服务自动启动 chkconfig --level 3 httpd on systemctl enable httpd.service
使某服务不自动启动 chkconfig --level 3 httpd off systemctl disable httpd.service
     
检查服务状态 service httpd status systemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅显示是否 Active)
启动某服务 service httpd start systemctl start httpd.service
停止某服务 service httpd stop systemctl stop httpd.service
重启某服务 service httpd restart systemctl restart httpd.service

(二)扩展

centos7中

yum install -y A   #安装

systemctl   status   A   # 管理

systemctl   start   A 

systemctl   stop  A 

systemctl   restart  A 

systemctl   enable  A 

systemctl   disable  A 

systemctl   list-units   --type=service   #  查看所有开机自动启动的服务

posted @ 2019-07-24 10:56  安迪9468  阅读(249)  评论(0编辑  收藏  举报