Changes to the system startup mode (startup level) --- using the upstart startup Mechanism

Source: Internet
Author: User
/********************************************************************* * Author  : Samson * Date    : 06/18/2014 * Test platform: *              Mint 15 *              GNU bash, version 4.2.45 * *******************************************************************/

There are three main methods to change the Startup Mode of the system based on the upstart mechanism (most of which are called the startup level, since the upstart mode still considers the compatibility with old systems such as system v, there is a file named: rc-sysinit.conf under/etc/init, the following three methods have been described in this file:
0) change the environment variable: ENV default_runlevel = 2 the graphic interface is generally 2. If you need to log on with a single user, set this value to 1;
1) Create the/etc/inittab file and configure it according to the old system V configuration method. For details about how to set System V, refer to the documents on the Internet, please find and learn about it yourself;
2) enter the corresponding startup mode Value in the kernel command-line. The file where the command line is read is/proc/cmdline, the corresponding value of this file is generally boot_image =/boot/vmlinuz-3.14. * root = UUID = 5d5daf1d-cf45-4f1c-b28d-e517a32dcf28 Ro quiet splash vt. handoff = 7 similar rows. This line is entered in the grub startup options. You can configure it by pressing the e key when the system starts. Only-S or 0 ~ exists ~ The value of default_runlevel will be changed to the corresponding value, and then start the corresponding startup mode using telinit $ {default_runlevel;

Introduction to upstart event DRIVER:

Http://blog.csdn.net/yygydjkthh/article/details/24796755


The main code is embodied in the rc-sysinit.conf, such as the following code:
Script
# Check for default runlevel in/etc/inittab
If [-r/etc/inittab]
Then
Eval "$ (sed-NRE's/^ [^ #] [^:] * :( [0-6ss]): initdefault :. */default_runlevel = "\ 1";/P'/etc/inittab | true )"
Fi

# Check kernel command-line for typical arguments
For ARG in $ (CAT/proc/cmdline)
Do
Case "$ {Arg}" in
-B | emergency)
# Emergency Shell
[-N "$ {from_single_user_mode}"] | sulogin
;;
[0123456ss])
# Override runlevel
Default_runlevel = "$ {Arg }"
;;
-S | Single)
# Single User Mode
[-N "$ {from_single_user_mode}"] | default_runlevel = s
;;
Esac
Done

# Run the system initialisation scripts
[-N "$ {from_single_user_mode}"] |/etc/init. d/RCS

# Switch into the default runlevel
Telinit "$ {default_runlevel }"
End Script

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.