systemctl 服务管理命令,我们知道centos6版本之前 服务管理采用service命令,但在centos7版本后采用了全新的systemctl命令来管理系统服务,systemctl命令语法格式如下:
systemctl [选项] [服务名]
对管理服务来说,有以下最常用的参数:
start :表示启动服务 restart :表示重启服务 status :表示查看服务状态 reload :表示重新加载 stop :表示停止服务 enable :表示服务开机自启 disable :表示禁止服务开机自启 list-unit-files :列出系统所有已安装的服务单元 list-units [PATTERN...] :列出当前内存中的服务单元 get-default :查看系统默认运行级别 set-default TARGET :设置系统默认运行级别 reboot :重启 poweroff :关机
演示示例:
[root@iflytek /]# systemctl start firewalld.service [root@iflytek /]# systemctl status firewalld.service [root@iflytek /]# systemctl restart firewalld.service [root@iflytek /]# systemctl reload firewalld.service [root@iflytek /]# systemctl stop firewalld.service [root@iflytek /]# systemctl enable firewalld.service [root@iflytek /]# systemctl disable firewalld.service [root@iflytek /]# systemctl list-unit-files



