Centos7 boot/etc/rc. local not executed
Recently, it was found that centos7's/etc/rc. local won't be started, so I carefully read the/etc/rc. local file and found the cause of the problem.
#!/bin/bash
#THISFILEISADDEDFORCOMPATIBILITYPURPOSES
#
#Itishighlyadvisabletocreateownsystemdservicesorudevrules
#torunscriptsduringbootinsteadofusingthisfile.
#
#Inconstrasttopreviousversionsduetoparallelexecutionduringboot
#thisscriptwillNOTberunafterallotherservices.
#
#Pleasenotethatyoumustrun'chmod+x/etc/rc.d/rc.local'toensure
#thatthisscriptwillbeexecutedduringboot.
Translation:
# This file is added for compatibility issues.
#
# We strongly recommend that you create your own systemd service or udev rules to run scripts at startup instead of using this file.
#
# This script will not be executed after all other services compared with the parallel execution during previous version boot.
#
# Remember, you must execute "chmod + x/etc/rc. d/rc. local" to ensure that this script is executed during boot.
So I confirmed the permission for/etc/rc. local.
[root@localhost~]
#ll/etc/rc.local
Lrwxrwxrwx.1rootroot13 October
/etc/rc
.
local
->rc.d
/rc
.
local
[root@localhost~]
#ll/etc/rc.d/rc.local
-Rw-r --. 1rootroot477, December 7, June 10
/etc/rc
.d
/rc
.
local
/Etc/rc. d/rc. local has no execution permission, so it is executed according to the description.
chmod
+x
/etc/rc
.d
/rc
.
local
After the restart, it is found that/etc/rc. local can be executed.
It looks like the version changes./etc/rc. local/etc/rc. d/rc. local is on the road of discarding.