CentOS 6和CentOS 7管理系统服务的区别

管理系统服务

CentOS 6

CentOS 7

firewalld.service可简写成firewalld

httpd.service可简写成httpd

关闭防火墙

# service iptables stop

# systemctl stop firewalld.service

禁止防火墙开机自启

# chkconfig iptables off

# systemctl disable firewalld.service

查看防火墙是否运行

# service iptables status

# firewall-cmd --state

暂时关闭SELinux

# setenforce 0

禁止SELinux开机自启

(永久关闭SELinux)

# vim /etc/selinux/config  -->   SELINUX=disabled  # reboot

查看SELinux状态

# getenforce

启动httpd服务

# service httpd start

# systemctl start httpd.service

停止httpd服务

# service httpd stop

# systemctl stop httpd.service

重启httpd服务

# service httpd restart

# systemctl restart httpd.service

条件式重启httpd服务

(服务之前已经启动-->重启

服务之前没有启动-->不做任何操作)

# service httpd condrestart

# service httpd try-restart

# systemctl condrestart httpd.service

# systemctl try-restart httpd.service

重载httpd服务

# service httpd reload

# systemctl reload httpd.service

重载或重启httpd服务

(服务支持重载-->重载

服务不支持重载-->重启)

# systemctl reload-or-restart httpd.service

重载或条件式重启httpd服务

(服务支持重载-->重载

服务不支持重载且之前已经启动-->重启

服务不支持重载且之前没有启动-->不做任何操作)

# systemctl reload-or-try-restart httpd.service

查看httpd服务是否运行

# service httpd status

# systemctl is-active httpd.service

# systemctl status httpd.service

设定httpd服务开机自启

# chkconfig httpd on

# systemctl enable httpd.service

禁止httpd服务开机自启

# chkconfig httpd off

# systemctl disable httpd.service

查看httpd服务是否开机自启

# chkconfig --list httpd

# systemctl is-enabled httpd.service

# systemctl status httpd.service

列出所有正在运行的服务

# systemctl list-units --type service

列出所有服务的开机自启状态

# chkconfig --list

# systemctl list-unit-files --type service

禁止设定httpd服务开机自启

(禁用# systemctl enable httpd.service)

# systemctl mask httpd.service

取消禁止设定httpd服务开机自启

(恢复# systemctl enable httpd.service)

# systemctl unmask httpd.service

查看httpd服务的依赖关系

# systemctl list-dependencies httpd.service

结束所有httpd进程

# killall httpd

# systemctl kill httpd




      本文转自Marion0728  51CTO博客,原文链接:http://blog.51cto.com/qiuyue/1950471,如需转载请自行联系原作者







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值