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# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES## It is highly advisable to create own systemd services or udev rules# to run scripts during boot instead of using this file.## In constrast to previous versions due to parallel execution during boot# this script will NOT be run after all other services.## Please note that you must run ‘chmod +x /etc/rc.d/rc.local‘ to ensure# that this script will be executed during boot.
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 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.
[[Email protected] ~] # Ll/etc/rc. locallrwxrwxrwx. 1 Root 13 October 13 06:09/etc/rc. Local-> rc. d/rc. Local [[email protected] ~] # Ll/etc/rc. d/rc. Local-RW-r --. 1 Root 477 June 10 13:35/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, and/etc/rc. Local/etc/rc. d/rc. Local is being discarded.
This article from the "Idle pool small building" blog, please be sure to keep this source http://soarwilldo.blog.51cto.com/5520138/1549656
Centos 7/etc/rc. Local cannot be started