Debian script Startup Mode

Source: Internet
Author: User
Debian script startup method-Debian information of the Linux release-the following is a detailed description. Like all Unix systems, Debian executes the init program during startup. the first execution script specified in the init configuration file (/etc/inittab) should be/etc/init. d/rcS. run the/etc/rcS script. d. Specify the script extension or derivative process in the directory to perform system initialization, such as checking and attaching file systems, loading kernel modules, starting network services, and setting the clock. next, for compatibility consideration, it runs/etc/rc. files in the boot/directory (except those file names that contain '. the scripts in the directory are usually used by the system administrator for software packages with compatibility issues.

After the system starts the process, init executes all the startup scripts specified by the default running level (indicated by the id in/etc/inittab. like most System V and Unix systems, Linux has seven running levels:

0 (shut down the system ),

1 (single user mode ),

2 to 5 (various multi-user modes), and

6 (restart the system ).

Debian system running id = 2, which indicates that the default running level is '2' when entering multi-user mode, so the script in/etc/rc2.d/will be run.

In fact, any directory/etc/rcN. all scripts in d/point to/etc/init. d/Symbolic Link (software link # ln-s source file target file name ). however, each/etc/rcN. the file name in the d/directory is used to specify/etc/init. d. Run the script. in particular, before entering any running level, all scripts whose names start with 'K' are run. The job of these scripts is to stop the process. then, all scripts whose names start with 'S' are run to start the process. the names are followed by the two digits after 'K' or 'S' to specify the order in which scripts run. scripts with small numbers are run first.

This method is used because/etc/init. the script in d/has a parameter that specifies that the script 'start', 'stop', 'reload', 'restart', or 'force-reload' is used to execute the task according to the values assigned by the parameters. these scripts can even be used to control various processes after the system is started.

For example, use a command with the 'reload' Parameter

/Etc/init. d/sendmail reload

Send a signal to the sendmail daemon process to re-read the configuration file.

You can add the project to be started in the rc. local file to enable automatic startup. Because rc. local is under/etc/init. d. Rc. local is also linked to the debian boot script rc2.d by default. Alternatively, you can directly create an executable script under/etc/init. d and directly create a symbolic link in rc2.d. For example, a firewall script is created under init. d, and a symbolic link # ln-s/etc/init. d/firewall S20firewall is placed under rc2.d.
Related Article

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.