From the Linux system version CentOS 6.x to CentOS 7.x changes overall is not large, but there are many places need our attention, most intuitive when the service Management command, before CentOS 7.x system we use service and chkconfig to manage the server , and in the CentOS 7.x version of Linux, systemctl a command is done, it integrates the service and Chkconfig functions in one. Here is a brief explanation today:
Systemctl Start *.service #启动某服务
Systemctl Stop *.service #停止某服务
Systemctl Restart *.service #重启某服务
Systemctl Reload *.service #重载某服务配置文件
Systemctl Status *.service #查询某服务运行状态
Systemctl is-enabled *.service #查看某服务是否开机启动
Systemctl Enable *.service #设置开机启动
Systemctl Disable *.service #取消开机启动
Systemctl–failed #查看启动失败的服务
Note: * refers to the name of the service, such as restart, iptables, we will do this:
[Root@21yunwei network-scripts]# Systemctl Stop Iptables.service
[Root@21yunwei network-scripts]# systemctl start Iptables.service
[Root@21yunwei network-scripts]# systemctl Restart Iptables.service
[Root@21yunwei network-scripts]# systemctl status Iptables.service
Iptables.service-ipv4 Firewall with Iptables
Loaded:loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset:disabled)
Active:active (exited) since Fri 2016-06-17 CST; 16s ago
process:48807 execstop=/usr/libexec/iptables/iptables.init Stop (code=exited, status=0/success)
process:48870 execstart=/usr/libexec/iptables/iptables.init Start (code=exited, status=0/success)
Main pid:48870 (code=exited, status=0/success)
June 17:52:05 21yunwei Systemd[1]: Starting IPV4 firewall with iptables ...
June 17:52:05 21yunwei iptables.init[48870]: iptables:applying firewall rules: [OK]
June 17:52:05 21yunwei Systemd[1]: Started IPV4 firewall with iptables.
[Root@21yunwei network-scripts]# systemctl is-enabled iptables.service
Enabled
Add a little tip: systemctl default does not have the server name is not complete, because the minimal installation does not carry out the installation package bash-completion, you need to perform the following command after the login system can see the command completion.
Yum Install-y bash-completion