Modification of 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 methods to modify the Startup Mode of the system based on the upstart mechanism (most of which are called the startup level, because 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 three modification methods are described in this file:
0) modify 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, configure the file according to the old system V configuration method, set the specific system V settings, and upload the documents online, please find and learn about it yourself;
2) enter the corresponding startup mode Value in the kernel command-line. The command line is read by the file:/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 corresponds to the grub startup option. You can configure it by pressing the e key when the system is started, as long as there is-s or 0 ~ The value of DEFAULT_RUNLEVEL will be changed to the corresponding value, and then start the corresponding startup mode using telinit $ {DEFAULT_RUNLEVEL;

For more information about upstart event driver, see:

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

The main code is embodied in the following code in the rc-sysinit.conf:
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.