First talk about Ubuntu, it has the concept of running level
0: Downtime
1: Single-user form, only root for maintenance
2: Multi-user, cannot use net file system
3: Full Multi-user
5: Graphical
6: Restart
Example: Starting or shutting down in the specified run level, in the specified order
UPDATE-RC.D start|stop
Example: Update-rc.d apachectl start 20 2 3 4 5. Stop 20 0 1 6.
A starts after B to start, B shuts down after
UPDATE-RC.D A Defaults 80 20
UPDATE-RC.D B Defaults 90 10
The following is the Ubuntu set up or log on or exit automatically run the way 1, the boot automatically run
After the ①linux is loaded, the hardware and the driver are initialized, and then the INIT program is found.
② load the system kernel, start the init process, the init process is the root process of Linux, all system processes are its child processes.
The ③init process reads the information from the/etc/inittab file and enters the preset runlevel. Typically, the startup script under the/etc/rcs.d/directory is executed first, followed by the/etc/rcn.d/directory. In this few directories, S starts with start-up and K starts without booting.
④ starts the Xwindow server Xorg,xwindow the GUI system under Linux based on the script in the/etc/rcs.d/folder.
⑤ Waiting for user login
Edit the/etc/rc.local file (usually the last boot), add Xinit or startx at the end of the text, and enter X-window directly after booting
We can also add a self-starter script here
Vim/etc/rc.local Add the script code in front of exit 0.
or update-rc.d the xxx default NN command (NN is the boot order), add the script to the initialization execution queue.
2. Automatically run when landing
When the user logs on, bash automatically executes the global login Script/etc/profile established by the system administrator.
Then bash in the user start directory in order to find one of three special files
. bash_profile. Bash_login. Profile, but only one of the first found is executed. Therefore, it is only necessary to add the command in the above file according to the actual need to enable users to automatically run certain programs when they log on
3. Run automatically when logging out
The. Bash_logout can write a backup here Tar-cvzf
4. Directly to the file under the/ETC/RCN.D directory, S starts with start and K is off.
5. Use the tools to set it all up
With rcconf or sysv-rc-conf.
Rcconf--list listed on and off things
--on [Service] boot-up services
--off [service] powering off services
Sysv-rc-conf Direct is the graphical control of the start-up things
Ubuntu Setup program boot or boot disable loading