Centos7 设置开机自启

1、编写脚本,比如:autostart.sh

2、赋予脚本可执行权限:

chmod +x autostart.sh

3、vim /etc/rc.d/rc.local,在末尾增加:

/目录/目录/autostart.sh

4、在 Centos7 中,/etc/rc.d/rc.local 的权限被降低了,所以需要执行如下命令赋予其可执行权限:

chmod +x /etc/rc.d/rc.local

 

参考:redhat7 设置开机自启 - zfno11 - 博客园 https://www.cnblogs.com/ZFBG/p/13673284.html