系統化的服務管理
上市服務
systemctl列出正在執行的服務systemctl --failed列出失敗的服務
管理目標(類似於 SysV 中的執行級別)
systemctl get-default查詢系統的預設目標systemctl set-default <target-name>設定系統的預設目標
在執行時管理服務
systemctl start [service-name]開始服務systemctl stop [service-name]停止服務systemctl restart [service-name]重啟服務systemctl reload [service-name]要求服務重新載入其配置systemctl status [service-name]顯示服務的當前狀態
管理服務的自動啟動
systemctl is-enabled [service-name]顯示是否在系統引導時啟用了服務systemctl is-active [service-name]顯示服務當前是否處於活動狀態(正在執行)systemctl enable [service-name]在系統引導時啟用服務systemctl disable [service-name]在系統引導時禁用服務
掩蔽服務
systemctl mask [service-name]掩蓋服務(使錯誤地啟動服務變得困難)systemctl unmask [service-name]取消遮蔽服務
重啟 systemd
systemctl daemon-reload