Main Menu

Search

LINUX: How To Make Shell Script Execute During Startup When Linux Server/Host Is Rebooted ? (rc3.d initscripts) (How To Doc)

In order to make shell script execute during startup when Linux Server is rebooted, we will have to add the shell script to rc3.d initscripts  (run level 3). Below are steps to follow:
1) Copy the shell script inside the /etc/init.d directory on Linux Host.
2) On Linux, execute below commands and create symbolic link.
# cd /etc/rc3.d


ln -s /etc/init.d/<scriptname> /etc/rc3.d/S99<scriptname>

With above commands the start order of the script after reboot will be in 99th place. You can change the number 99 to the number you want to initiate the script during reboot. Usually it is best practive to have all the user scripts execute after the initialization OS level scripts.

3) Reboot the Linux machine.
Products to which Article Applies

All Linux Operating Systems.


Additional References

https://www.heatware.net/linux-unix/run-a-script-on-linux-startup-in-2-simple-steps/




tarun boyella

No comments:

Post a Comment