使用systemctl管理服務
服務的啟動與停止
服務的啟動與停止
命令格式:systemctl 選項 服務名
選項說明:
start:啟動;stop:停止;restart:重啟;status:服務狀態
服務名:一般以“.service”結尾,輸入服務名時了可省略,
設定服務的自啟動狀態
使用 ntsysv 命令設定服務的自啟動
命令格式:ntsysv [--back][--level]
ntsysv 圖形化設定開機自動啟動
空格選中是否啟動
TAB鍵切換按鈕
選項說明:back,在互動界面不顯示 cancel;level,在指定的運行級別中設定服務的自啟動,
使用 systemctl 命令設定服務的自啟動
查看服務的自啟動狀態:systemctl is-enabled [服務名稱]
開啟服務的自啟動:systemctl enable 服務名稱
關閉服務的自啟動:systemctl disable 服務名稱
查看所有服務
查看所有的服務
命令格式:systemctl [選項] [–type=TYPE] [–all]
選項說明:
list-units:依據 unit 列出所有啟動的 unit,加上–all 會列出沒啟動的 unit;
list-unit-files:依據/usr/lib/systemd/system/ 內的啟動檔案,列出啟動檔案串列 –type=TYPE: 為 unit type, 主要有 service, socket, target
#systemctl //列出所有的系統服務
#systemctl list-units //列出所有啟動 unit
#systemctl list-unit-files //列出所有啟動檔案
#systemctl list-units -type=service -all //列出所有 service 型別的 unit
#systemctl list-units -type=service -all grep cpu //列出 cpu 電源管理機制的服務
#systemctl list-units -type=target -all //列出所有目標單元 target
systemctl命令特殊功能
systemctl poweroff 系統關機
systemctl reboot 重新啟動
systemctl suspend 進入睡眠模式
systemctl hibernate 進入休眠模式
systemctl rescue 強制進入救援模式
systemctl emergency 強制進入緊急救援模式
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/153753.html
標籤:Linux
上一篇:Linux:系統的啟動程序
