/********************************************************************* * 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