关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

Cenetos系统服务器检查/设置服务运行情况的命令

发布时间:2022/9/9 13:42:35
香港云服务器

Centos系统如何启动/关闭某项服务?如何设置服务自动启动?本文将主要列举CentOS系统服务器中常用的服务相关命令。


服务(service)启动相关命令(以httpd服务为例)

因系统命令不同,命令也不同;一般Centos5.x/6.x使用旧命令、Centos7.x/8.x使用新命令:


任务旧命令新命令
使某服务开机自动启动Chkconfig --level   3 httpd onsystemctl enable   httpd.service
使某服务开机不自动启动chkconfig --level   3 httpd offsystemctl disable   httpd.service
检查服务状态service httpd   statussystemctl   status httpd.service (服务详细信息)
systemctl   is-active httpd.service(仅显示是否Active)
显示所有已启动的服务chkconfig --listsystemctl list-unit-files
systemctl   list-units --type=service
启动某服务service httpd   startsystemctl start   httpd.service
停止某服务service httpd   stopsystemctl stop   httpd.service
重启某服务service httpd   restartsystemctl restart   httpd.service