比如服务名称为: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 |