RedHat/CentOS7使用systemctl来启动/停止/重启服务及开机加载
RHEL/CentOS 7中一个最主要的改变,就是切换到了systemd,之前用于启动、重启、停止各种服务的 service 作为向后兼容的指令还能使用,但是将来可能会消失。同时,chkconfig 也改成了 systemctl 了,记录如下:
启动服务:
systemctl start httpd
停止服务:
systemctl stop httpd
重启服务(先停止,后启动):
systemctl restart httpd
重新加载(使用新的配置文件):
systemctl reload httpd
显示服务状态:
systemctl status httpd
与此同时,之前用于设定系统启动时自动运行某服务的指令 chkconfig 也改了,还是用 systemctl。
chkconfig service on
改成了:
systemctl enable httpd
chkconfig service off
改成了:
systemctl disable httpd
检查服务状态的
chkconfig service
改成了:
systemctl is-enabled httpd
列举出所有服务的指令,
chkconfig –list
改成了:
systemctl list-unit-files --type=service
更多使用systemctl -help查看·
最后更新于 2016-12-30 20:28:46 并被添加「linux systemctl 启动 chkconfig 服务」标签,已有 2494 位童鞋阅读过。
本站使用「署名 4.0 国际」创作共享协议,可自由转载、引用,但需署名作者且注明文章出处