Linux控制服務-systemctl
阿新 • • 發佈:2018-12-14
systemctl:使用者管理各種型別的systemctl物件,包含服務管理、電源管理、掛載點管理等功能
設定開機自啟
systemctl enable service
關閉開機自啟
systemctl disable service
檢視某一單元狀態
systemctl status service
舉例: ssh協議程序是sshd
#systemctl status sshd.service ● sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled(表示開機自啟動,disabled不自啟); vendor preset: enabled) Active: active(表示執行中,inactive表示停止) (running(表示正在執行,waiting表示在等待事件)) since 三 2018-10-10 12:10:23 CST; 9min ago Docs: man:sshd(8) man:sshd_config(5) Main PID: 1061 (sshd) CGroup: /system.slice/sshd.service └─1061 /usr/sbin/sshd -D
啟動服務
systemctl start service
停止服務
systemctl stop service
重啟服務
systemctl restart service
過載服務(重新載入配置檔案)
systemctl reload service
檢視所有已啟動單元
systemctl list-units