CentOS 7.X systemctl Command usage detailed

Source: Internet
Author: User
Tags centos iptables

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.