systemctl相當(dāng)于service和chkconfig的結(jié)合體溪猿,使用它可以永久性啟用/禁止或臨時(shí)關(guān)閉/啟動(dòng)某個(gè)服務(wù)。
systemctl與service
service命令 | systemctl命令 | 備注 |
---|---|---|
service XXX start | systemctl start XXX | 啟動(dòng)服務(wù) |
service XXX stop | systemctl stop XXX | 停止服務(wù) |
service XXX restart | systemctl restart XXX | 重啟服務(wù) |
systemctl與chkconfig
chkconfig命令 | systemctl命令 | 備注 |
---|---|---|
chkconfig XXX on | systemctl enable XXX | 設(shè)置開機(jī)啟動(dòng) |
chkconfig XXX off | systemctl disable XXX | 禁止開機(jī)啟動(dòng) |
systemctl其他語法
systemctl命令 | 備注 |
---|---|
systemctl mask XXX | 屏蔽服務(wù)(無法啟動(dòng)) |
systemctl unmask XXX | 取消屏蔽 |
systemctl is-active XXX | 查看服務(wù)狀態(tài) |
systemctl is-enable XXX | 查看某個(gè)服務(wù)是否開機(jī)啟動(dòng) |
systemctl list-unit-files|grep enabled | 查看服務(wù)是否開機(jī)啟動(dòng) |
systemctl failed | 查看啟動(dòng)失敗的服務(wù) |