Please explain init and sysvinit workflow taking an example

Asked by pankaj on 2013-05-04

Can you please explain the basic workflow (ie step wise) how the sysvinit and upstart start the system. What are the process and file are accessed by them ?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu upstart Edit question
Assignee:
No assignee Edit question
Last query:
2013-05-04
Last reply:
2013-05-04

The files in /etc/init are scripts. They can be called with various options. The usual ones are start, stop and status. These are symlinked into /etc/rc.X with X being the runlevel which something happens if you symlink that script to the relevant folder. If you look in the folder you will see K And S. K is for kill and S is for start. The following number is for ordering so that processes are killed in a certain order or started. The K processes are processed first followed by the S ones.

So if you are in a text based boot and run:

init 5

You will stop all thee proceseses with K in /etc/rc.4 and then run the S ones in the same folder, then stop the processes with K in them in /etc/rc.5 and start the ones with S in the same folder. You will then be in runlevel 5. If you then run:

init 1

You will go though each folder in turn in the same way as above all the way down to /etc/rc.1

You can use true files in the /etc/rc.X folders but symlinks make life easier as a change to the one script in /etc/init will affect all runlevels it is linked in.

The actual name of thr symlink and scriptname are only for human convenience. The letter and number are all the system looks at.

Can you help with this problem?

Provide an answer of your own, or ask pankaj for more information if necessary.

To post a message you must log in.