【Linux】关于 CentOS7.x /etc/rc.d/rc.local

CentOS6.x上习惯用 /etc/rc.local 文件来开机自启动我们一些服务或者操作了,但是CentOS7.x改了,chkconfig也不能用了。

CentOS7.x 已经写了要chmod +x /etc/rc.d/rc.local 授权一下才会起作用。


# cat /etc/rc.d/rc.local


# systemctl status rc-local.service

# cat /usr/lib/systemd/system/rc-local.service


从  ConditionFileIsExecutable=/etc/rc.d/rc.local  字段可以看出,/etc/rc.d/rc.local需要赋予x权限, rc-local.service才会开机执行!



CentOS70x 下/etc/rc.local文件里配置的开机启动项不执行的解决办法

https://www.cnblogs.com/kevingrace/p/8387827.html


How to Execute Scripts/Commands using /etc/rc.d/rc.local in CentOS/RHEL 7

https://www.thegeekdiary.com/how-to-execute-scripts-commands-using-etc-rc-d-rc-local-in-centos-rhel-7

你可能感兴趣的:(【Linux】关于 CentOS7.x /etc/rc.d/rc.local)