What should I do if the rc.local script of the CentOS7 server does not automatically execute when it starts up?

 First check whether there is the following content in the /usr/lib/systemd/system/rc-local.service file, if not, add it

[Install]

WantedBy=multi-user.target

Then check the status of the self-starting command service, dead means that the rc-local service is not started

systemctl status rc-local

Start the rc-local service

systemctl start rc-local

The service is added to start automatically at boot

systemctl enable rc-local

Then grant executable permissions to the rc.local file

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

Done, reboot

reboot

Guess you like

Origin blog.csdn.net/zdb1314/article/details/123563885