Ubuntu startup level (RunLevel) analysis

Source: Internet
Author: User
Keywords Ubuntu runlevel start level
Tags analysis connections control control system default different etc file

In order for Vidalia to start Tor and Polipo, instead of letting themselves run as a service, I learned about the startup level of Ubuntu, Google a bit, read some Chinese, and then #ubuntu-cn consulted, write down their own experience, Hope to help everyone, but also want Daniel to corrections. Enter the following text:

In the Linux world, all Linux operating systems have a startup level concept that controls the different functions that are loaded when the system starts up, essentially running a variety of services after startup (servcie| | Daemon). The service here is similar to the concept of service in Windows, a program that runs independently in the background of the system, which means that he generally does not interact with the user.

General Linux is divided into 8 levels: 0-6 and one ' S ' level. 0 represents a shutdown (halt), 6 represents a reboot (restart), 1-5 is a different level of functionality, where 1 levels are Single-user mode (single) and 2-5 are different. But there is no difference between the 2-5 levels in UserLinux (including Ubuntu). The last ' S ' level is a more specific level, and he should be the one that runs before the other level. (This remains to be verified). This explains that the 0-6 level of operation is mutually exclusive, rather than superimposed, that is, if you enter the 4 level, it is not 0-3 to run, but only to complete the services specified in Level 4.

A little view of the completion of the Ubuntu run level will find that all the scripts running the service are stored in the/etc/init.d/. And in the/etc/has the RC ' X '. D's folder, ' X ' stands for 0-6 and X, and corresponds to these 8 startup levels, which are all pointing to the soft connection of the script running the service inside the/etc/init.d/(symbol link), which finds that the number of soft connections is less than the number of running scripts, This means that not all services are run at one level. The naming of soft connections is regular: [k| S][0-90-9][http://www.aliyun.com/zixun/aggregation/11696.html ">name],k represents the start of the kill,s, followed by a two-digit number, and finally the corresponding script file name for the running service. The name is the parameter passed when the corresponding script is run, K is to pass the stop (that is, to turn off the service), S is to pass start (is to start the service).

Order of operation: K decimal->k large number->s decimal->s large number. Note that all soft connections in the folder will be executed regardless of K or S.

In addition, most Linux uses a mechanism called System V to start the run level (like serial, slow?). And Ubuntu is using another mechanism called startup (as if it were parallel, fast?). ), so no Inittab file changes to the default run level. Ubuntu9.10 seems to be compatible with Inittab, but not at 9.10, and 9.10 sets the default run level files are different from the previous version of Ubuntu. The default run level file for Ubuntu 9.10 is the 14 line for this/etc/init/rc-sysinit.conf.

If you want to delete a service that runs at a run level, you can delete the soft connection name in the corresponding RCX.D folder in lowercase (this is recommended by the Debian article, and it is bum), or you can remove it (this is the sysv-rc-conf approach). Of course, you can also write a script and then create a soft connection, you can add a service.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.