Run a script on Linux startup in 2 simple steps
There are several ways to run a script or program at startup on a Linux machine, especially when taking into account the various run levels. This example is a quickstart method on how to run it at run level 3.
- Copy your script or file to /etc/init.d
- Create a symbolic link from this file to the appropriate run-level directory
ln -s /etc/init.d/your_filename.ext /etc/rc.d/rc3.d/S99your_filename-without-extension
Note: Be sure to substitute your_filename.ext with your script’s full filename and replace your_filename-without-extension with your script’s filename without the extension.
For example:
ln -s /etc/init.d/script.sh /etc/rc.d/rc3.d/S99script
what is this S99 and K99 stands for ?