Systemd 的簡介和特點
Systemd 是 Linux 系統中最新的初始化系統(init),它主要的設計目標是克服 sysvinit 固有的缺點,提高系統的啟動速度。
舊版sysvinit與新版systemd指令對照
啟動服務:
systemctl start httpd systemctl start httpd.service
停止服務:
systemctl stop httpd systemctl stop httpd.service
重啟服務(先停止,後啟動):
systemctl restart httpd
重新載入(使用新的設定檔):
systemctl reload httpd
顯示服務狀態:
systemctl status httpd
與此同時,之前用於設定系統啟動時自動運行某服務的指令 chkconfig 也改了,還是用systemctl。
chkconfig service on
改成了,
systemctl enable httpd systemctl enable httpd.service
系統啟動時自動關閉服務
chkconfig service off
改成了,
systemctl disable httpd
檢查服務狀態
chkconfig service
改成了,
systemctl is-enabled httpd
列舉出所有服務的指令,
chkconfig –list
改成了,
systemctl list-unit-files --type=service