Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器。
Systemd是一个系统管理守护进程、工具和库的集合,用于取代System V初始进程。
Systemd的功能是用于集中管理和配置类UNIX系统。
重要:
Systemctl 接受 服务(.service),挂载点(.mount),套接口(.socket)和设备(.device)作为单元。
RHEL 7相关命令和之前的对比
(systemctl命令中服务名后面的.service可以省略)
作用 | Centos7之前 | Centos7 |
---|---|---|
启动服务 | service firewalld start | systemctl start firewalld.service |
重启服务 | service firewalld restart | systemctl restart firewalld.service |
停止服务 | service firewalld stop | systemctl stop firewalld.service |
重新加载配置文件(不终止服务) | service firewalld reload | systemctl reload firewalld.service |
查看服务状态 | service firewalld status | systemctl status firewalld.service |
设置开机启动 | chkconfig --level 3 firewalld on | systemctl enable firewalld.service |
开机不自启动 | chkconfig --level 3 firewalld off | systemctl disable firewalld.service |
查看所有已启动的服务 | chkconfig --list | systemctl list-units --type=service |
查看所有服务列表:
systemctl list-unit-files --type=service
列出所有运行中单元
systemctl list-units
查看服务是否开机启动:
systemctl is-enabled firewalld.service
查看启动失败的服务列表:
systemctl --failed
网友评论