systemd 是 Linux 下的一款系統和服務管理器,兼容 SysV 和 LSB 的啓動腳本。systemd 的特性有:支持並行化任務;同時採用 socket 式與 D-Bus 總線式激活服務;按需啓動守護進程(daemon);利用 Linux 的 cgroups 監視進程;支持快照和系統恢復;維護掛載點和自動掛載點;各服務間基於依賴關係進行精密控制。nginx
任務socket |
舊指令ide |
新指令spa |
使某服務自動啓動hibernate |
chkconfig --level 3 httpd onrest |
systemctl enable httpd.service進程 |
使某服務不自動啓動ip |
chkconfig --level 3 httpd offci |
systemctl disable httpd.service |
檢查服務狀態 |
service httpd status |
systemctl status httpd.service (服務詳細信息) systemctl is-enabled httpd.service (僅顯示是否 Active) |
顯示全部已啓動的服務 |
chkconfig --list |
systemctl list -units --type=service |
啓動某服務 |
service httpd start |
systemctl start httpd.service |
中止某服務 |
service httpd stop |
systemctl stop httpd.service |
重啓某服務 |
service httpd restart |
systemctl restart httpd.service |
某服務從新加載配置文件 |
service httpd reload |
systemctl reload httpd.service |
# systemctl #輸出已激活單元 # systemctl list-units #輸出已激活單元 # systemctl --failed #輸出運行失敗的單元 # systemctl list-unit-files #查看全部已安裝服務 # systemctl start nginx #啓動nginx # systemctl stop nginx #中止nginx # systemctl restart nginx #重啓nginx # systemctl reload nginx #從新加載nginx配置 # systemctl status nginx #輸出nginx運行狀態 # systemctl is-enabled nginx #檢查nginx是否配置爲自動啓動 # systemctl enable nginx #開機自動啓動nginx # systemctl disable nginx #取消開機自動啓動nginx # systemctl help nginx #顯示nginx的手冊頁 # systemctl daemon-reload #從新載入 systemd,掃描新的或有變更的單元 # systemctl reboot #重啓 # systemctl poweroff #退出系統並中止電源 # systemctl suspend #待機 # systemctl hibernate #休眠 # systemctl hybrid-sleep #混合休眠模式(同時休眠到硬盤並待機 # systemctl isolate graphical.target #等價於telinit 3 或 telinit 5