原命令 | 现命令 | 备注 |
service httpd start | systemctl start httpd.service |
启动 httpd 服务 |
service httpd stop | systemctl stop httpd.service |
关闭 httpd 服务 |
service httpd restart | systemctl restart httpd.service |
重启 httpd 服务 |
service httpd reload | systemctl reload httpd.service |
重新驱动服务配置 (须服务支持) |
service httpd condrestart | systemctl condrestart httpd.service |
重启 httpd 服务(如原 服务是关闭状态,则 命令无效) |
service httpd status | systemctl status httpd.service |
打印 httpd 服务运行 状态 |
ls /etc/rc.d/init.d/ |
systemctl 或
systemctl list-unit-files --type=service或
ls /lib/systemd/system/*.service 或
ls /etc/systemd/system/*.service
|
列出所有的服务和单元 |
chkconfig httpd on | systemctl enable httpd.service |
开启 httpd 服务随机启 动,在下次重启生效, 或切换运行级别 |
chkconfig httpd off | systemctl disable httpd.service |
关闭 httpd 服务随机 启动,在下次重启生 效,或切换运行级别 |
chkconfig httpd | systemctl is-enabled httpd.service |
打印 httpd 服务的随 机启动设置状态 |
chkconfig --list |
systemctl list-unit-files --type=service(preferred)
ls /etc/systemd/system/*.wants/
|
列出所有服务的设置 (启动或关闭) |
chkconfig httpd --list | ls etc/systemd/system/*.wants/httpd.service |
列出 httpd 服务在所有 运行级别中的设置 |
chkconfig httpd --add | systemctl daemon-reload |
创建新配置文件或者修 改配置文件后重新读取 |