1) sudo sysv-rc-conf

2)systemctl

systemctl is-enabled servicename.service #查询服务是否开机启动
systemctl enable *.service #开机运行服务
systemctl disable *.service #取消开机运行
systemctl start *.service #启动服务
systemctl stop *.service #停止服务
systemctl restart *.service #重启服务
systemctl reload *.service #重新加载服务配置文件
systemctl status *.service #查询服务运行状态

3) 添加自自动

vim new_servers.sh

sudo chmod 755 new_service.sh

sudo mv new_service.sh /etc/init.d/

cd /etc/init.d/

sudo update-rc.d new_service.sh defaults 90


ref: https://bbs.csdn.net/topics/392153774

ref: https://blog.csdn.net/qq_21904665/article/details/79297832

11-15 12:28