I am learning command line from a book called "Linux Command Line and Shell Scripting Bible, Second Edition." The book states this:
Some Linux implementations contain a table of processes to start
automatically on bootup. On Linux systems, this table is usually
located in the special file /etc/inittabs.Other systems (such as the popular Ubuntu Linux distribution) utilize
the /etc/init.d folder, which contains scripts for starting and
stopping individual applications at boot time. The scripts are started
via entries under the /etc/rcX.d folders, where X is a run level.
Probably because I am new to linux, I did not understand what the second paragraph quoted meant. Can someone explain the same in a much plainer language?
Best Answer
Let's forget
init.d
orrcx.d
and keep things very simple. Imagine you were programming a program whose sole responsibility is to run or kill other scripts one by one.However your next problem is to make sure they run in order. How would you perform that?
And lets imagine this program looked inside a
scripts
folder for running the scripts. To order the priority of scripts you would name them in lets say numerical order. This order is what dictates the relation betweeninit.d
andrc
In other words
init.d
contains the scripts to run and thercX.d
contains their order to run.The
X
value inrcX.d
is the run level. This could be loosely translated to the OS current state.If you dig inside the
rcX.d
scripts you will find this formatting:X
is replaced withK
orS
, which stands for whether the script should bekilled
orstarted
in the current run levelxx
is the order numberabcd
is the script name (the name is irrelevant however where it points is the script this will run)