這裡以sshd.service為例
1)檢視服務啟動級别
cat /lib/systemd/system/sshd.service
'''
[Install]
WantedBy=multi-user.target #級别3
'''
2)檢視服務狀态
systemctl status sshd.service
3)啟動服務
systemctl start sshd.service
4)重新開機服務
systemctl restart sshd.service
5)關閉服務
systemctl stop sshd.service
6)重載服務
reload也叫平滑重新開機,正在連接配接的使用者是沒有感覺的,隻有當使用者再次連接配接時,會啟用新的配置。
systemctl reload sshd.service
7)開機啟動
systemctl enable sshd.service
8)開機不啟動
systemctl disable sshd.service
9)檢視是否開機啟動
systemctl is-enable sshd.service
10)是否在啟動狀态
systemctl is-active sshd.service
11)重載systemd服務清單
systemctl daemon-reload