`

Linux 的启动流程

 
阅读更多

the start order
1 boot kernel
OS reading kernel file under /boot directory
2 start init programe
 
/sbin/init it's the first program the kernel starts
when booting.
init , which can be found in /sbin/init,
 is responsible for getting the system up
and running after the kernel has finished booting.
the pid is 1.
3 identify the running level
There are lots of programe need to be started after
system starting up.

[The programe in win is called service
The programe in linux is called daemon.]

and to run such programe is the main task of init process.
when the OS starting,some of the programe will be started
according the it's runlevel.

the runlevel in linux
#runlevel 0 is System halt<Do not use this for initdefault!>
#runlevel 1 is Single user mode
#runlevel 2 is Local multiuser without remote network
                                <e.g NFS>
#runlevel 3 is Fullmultiuser with network
#runlevel 4 is Not used
#runlevel 5 is Full multiuser with network and xdm
#runlevel 6 is Single reboot<Do not use this
                                for initdefault!>
init process will first read the file:
/etc/inittab
and there is an line shown how the current system starting
running level:
id:5:initdefault:

and we could change such value mannually.

and we could find the programmes in each run level:
  /etc/rc.d/rc0.d
  /etc/rc.d/rc1.d
  /etc/rc.d/rc2.d
  /etc/rc.d/rc3.d
  /etc/rc.d/rc4.d
  /etc/rc.d/rc5.d
  /etc/rc.d/rc6.d

4 all the start shell are in /etc/init.d folder<contains the scripts executed by init at boot time and when the init state.>
and /etc/rcN.d are store the syble link of the shell under /etc/init.d folder
and if you need to start or stop one process mannually
the cd to the folder /etc/init.d
$/etc/init.d/apache2 restart

5 user login

 

 

参考文章:

http://www.ruanyifeng.com/blog/2013/08/linux_boot_process.html

http://www.debianadmin.com/manage-linux-init-or-startup-scripts.html

http://www.debianadmin.com/remove-unwanted-startup-files-or-services-in-debian.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics