一、相关命令
1.查看所有系统服务
systemctl list-units --all --type=service
2.查询服务状态
systemctl status httpd.service
3.查询服务是否为开机启动
systemctl is-enabled httpd.service
enabled是 disabled否
4.设置服务为开机启动状态
systemctl enable httpd.service
会自动创建一个系统链接
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
5.设置服务为开机不启动状态
systemctl disable httpd.service
会自动移除系统链接
Removed symlink /etc/systemd/system/multi-user.target.wants/httpd.service.
二、设置httpd开机自启动
systemctl enable httpd.service