This is possible with renaming of the scripts located in running configuration(rc) folders such as /etc/rc1.d, /etc/rc2.d etc. Each of these folders are corresponding to the scripts that will start in that run-level respectively. For example if you want to start some script in runlevel 1, then they should be kept in /etc/rc1.d folder so that when Linux OS is booting up these scripts are executed.

So how can I set priority to my scripts/services?
 Just go in to one of the rc folders, you can see all the scripts which will start in that perticular runlevel.
If you observe those scripts, the name will start with  either K(k for kill) or S(s for start) followed with numbers as shown below.

K09apache2
K15pulseaudio
K20acpi-support
K74bluetooth
README
S30killprocs
S70dns-clean
S70pppd-dns
S90single

So the scripts(services) which ever starts with K, will be killed in the numbering sequence and scripts which starts with S will start according to number followed by first character ie S.

So if you want to start S70dns-clean before all the scripts in this runlevel change the number to S01dns-clean. Thats it, you are done.

Before editing the script name:

K09apache2
K01pulseaudio
K20acpi-support
K74bluetooth
README
S30killprocs
S70dns-clean
S70pppd-dns
S90single

After edting the script name:

K09apache2
K01pulseaudio
K20acpi-support
K74bluetooth
README
S30killprocs
S01dns-clean
S70pppd-dns
S90single

So now the first script/service which start in this list is S01dns-clean
Please comment your thoughts on this. Please visit https://www.linuxnix.com for more linux admin stuff.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.