比如服務名稱爲:xxx.service
CentOS7以前(兼容以後) | CentOS7以後 | |
---|---|---|
啓動服務 | service xxx start | systemctl start xxx |
停止服務 | service xxx stop | systemctl stop xxx |
重啓服務 | service xxx restart | systemctl restart xxx |
設置開機自啓動 | chkconfig xxx on 或者 chkconfig --add xxx | systemctl enable xxx |
取消開機自啓動 | chkconfig xxx off 或者 chkconfig --del xxx | systemctl disable xxx |