How to automatically run script at boot time in Centos 7

Following are simple instructions on how to automatically run script at boot time in Centos 7.

Because/etc/rc.d/rc.local is no longer being executed by default due to changes in systemd related to new vs of Centos, you will need to make /etc/rc.d/rc.local executable, by using this command:

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

Once this is done, edit the file /etc/rc.local (this is a a symbolic link to /etc/rc.d/rc.local) and to the bottom of it simply add the line pointing to your shell script:

/root/MyShScript.sh

And then to make it executable, run:

chmod +x /root/MyShScript.sh

Enjoy!

Facebook Comments