Friday 15 February 2013

linux - Init process interaction with shell cripts -


Almost all Linux courses say that the input process, which is run level, to open them, the appropriate shell script Will execute. But none of these courses expands how the init process does this.

As I understand the init process is basically a program, like Hello World C code. Only a lot more sophisticated Does anyone know how this program actually runs through all the scripts and invites them?

I really appreciate any answers and especially if you have a link to an example source code.

Tells you in various documents that:

  • and you can find its source code there:

    • Originally, for the role of init process 1, fork () is every application on your system. If you boot up Linux with the command line init = / bin / sh at boot time, then the process forked by the kernel will be a shell. The Sysvinit program will be a bit more in handling complex boots Makes easy It connects the concept of runlevels, defines basic environments etc. So that it makes it easy to boot a system and for many services, and not just one shell, that part is explained well which I gave you.

      Does anyone know how this program actually runs through all the scripts and invites them?

      OK, the simplest in your question is as simple as when you boot your system, the inittab file is read in init, it shows that What are your preferences (What is the default runlevel? Which console is? How many consoles? ..), and will create a shell for the chosen runlevel that will execute the startup script. After that Shell script made its script its way, which you activated with /etc/init.d . Generally the Shell Script part is very distributed-specific, which is why I gave you two links about it, and you feel that it is different on Ubuntu and Debian ...

      source code For more details, you may want to start under init.c which has the main loop of init.

      And +1 on your question for your curiosity!

No comments:

Post a Comment