2016年1月10日 星期日

systemd 基本管理方式

#systemctl --help                           #查詢systemctl指令用法
#systemctl list-units                       #查詢目前所有啟動中的服務
#systemctl list-units -a                   #查詢目前所有已啟動及未啟動的服務
#systemctl enable xxx.service      #設定開機啟動xxx.service
#systemctl disable xxx.service      #設定開始不啟動xxx.service
#systemctl stop xxx.service          #立即停止xxx.service
#systemctl start xxx.service          #立即啟動xxx.service
#ssytemctl status xxx.service       #查詢xxx.serivce目前的狀態

#systemctl is-active xxx.service   #查詢服務是否正常啟動

Centos 7 Run Level修改

顯示可用的運作層級
systemctl list-units --type target

顯示目前系統預設層級
systemctl get-default

切換到Run Level 3 [文字模式]
 systemctl isolate multi-user.target

切換到Run Level 5 [圖形模式]
 systemctl isolate graphical.target

設定開機為Run Level 3  [文字模式]
systemctl set-default multi-user.target

設定開機為Run Level 5 [圖形模式]
 systemctl set-default graphical.target