Linux Custom Boot Service

Source: Internet
Author: User

Turn http://www.cnblogs.com/jimeper/archive/2013/03/12/2955687.html

Create a service manually

1. Create a shell script in the/ETC/RC.D/INIT.D directory, file name Auto_run

2.chkconfig--add Auto_run

Self-starting Shell format and attention points

Example, the first three lines of Auto_run are as follows:
#!/bin/sh
#chkconfig: 2345 80 90
#description: Auto_run
The first line tells the system to use the shell, so the shell script is like this.
The second line, chkconfig after the three parameters 2345,80 and 90 tells the Chkconfig program, need to RC2.D~RC5.D directory, create a file name S80auto_run, connect to/etc/rc.d/ The Auto_run script under the INIT.D directory. The first character is S, when the system starts, run the script auto_run, it will add a start parameter, tell the script, is now the startup mode. At the same time in the RC0.D and RC6.D directory, create a file connection named K90auto_run, the first character is K, when the system shuts down the system, it will run Auto_run, add a stop, tell the script, is now off mode.
Note that in the above three rows, the second, the third line is required, otherwise, when running Chkconfig--add Auto_run, an error will be shown.
4. Common Mistakes
"Service does not support Chkconfig":
Please note that there are two full lines in front of the check script:
#chkconfig: 2345 80 90
#description: Auto_run
In front of the script these two lines are not few, otherwise cannot chkconfig the command will report the error.
If the running Chkconfig always error, if the script is not a problem, I suggest, directly under RC0.D~RC6.D to create a file connection to the script to resolve, the principle is the same.

Linux Custom Boot Service

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.