service命令與systemctl區別
service一般和ckconfig搭配使用
service常用命令就是啓動,停止,重啓動和查看服務
命令(alert進程爲例) | service | systemctl |
啓動 | service start alert | systemctl alert start |
停止 | service stop alert | systemctl alert stop |
重啓 | service restart alert | systemctl alert restart |
查看 | service status alert | systemctl alert status |
啓動開機自啓 對應
|
chkconfig alert on (reset表示重置) | systemctl enable alert |
查看所有開機項 | chkconfig --list或直接輸入chkconfig
|
systemctl list-unit-files
|
關閉開機項
|
chkconfig alert off | systemctl disable alert |
確定某進程是否是開機項 |
|
systemctl is-enabled xxx(進程名) |
systemd是Linux系統中最新的初始化系統(init),它主要的設計目的是提高系統的啓動速度。監視和控制systemd的主要命令是systemctl。該命令可用於查看系統狀態和管理系統及服務
配置文件:
/usr/lib/systemd/system:每個服務最主要的啓動腳本設置,類似於之前的/etc/initd.d
/run/system/system:系統執行過程中所產生的服務腳本,比上面的目錄優先運行
/etc/system/system:管理員建立的執行腳本,類似於/etc/rc.d/rcN.d/Sxx類的功能,比上面目錄優先運行,在三者之中,此目錄優先級最高
chkconfig是管理系統服務(service)的命令行工具。