systemctl

systemctl相当于servicechkconfig的结合体,使用它可以永久性启用/禁止或临时关闭/启动某个服务。

systemctl与service

service命令 systemctl命令 备注
service XXX start systemctl start XXX 启动服务
service XXX stop systemctl stop XXX 停止服务
service XXX restart systemctl restart XXX 重启服务

systemctl与chkconfig

chkconfig命令 systemctl命令 备注
chkconfig XXX on systemctl enable XXX 设置开机启动
chkconfig XXX off systemctl disable XXX 禁止开机启动

systemctl其他语法

systemctl命令 备注
systemctl mask XXX 屏蔽服务(无法启动)
systemctl unmask XXX 取消屏蔽
systemctl is-active XXX 查看服务状态
systemctl is-enable XXX 查看某个服务是否开机启动
systemctl list-unit-files|grep enabled 查看服务是否开机启动
systemctl failed 查看启动失败的服务

推荐阅读更多精彩内容