一、相關命令
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
重啓即可。