Linux system self-booting foot

Source: Internet
Author: User

just edit the/etc/init.d/rc.local file and add your script at the end.

For example: I have written a script shell.sh, stored under/home/mars704/desktop/
In terminal input gedit/etc/init.d/rc.local edit the file, at the end of the join:
/home/mars704/desktop/sh.sh Automatic Load Script


First of all, the Linux random Startup service program is in/ETC/INIT.D this folder, the files are all script files (the script is simply to run the program to write to a file, so that the system can be executed sequentially, Similar to Windows Autorun.dat file), in addition to/etc This folder also has such as the name RC1.D, rc2.d to Rc6.d folder, these are different Linux runlevel, we generally enter the X Windows multi-user RunLevel is level 5th, which is rc5.d, the script file under this folder is the service program that starts randomly when you run level 5th. It is important to note that the files under each RC (1-6). D folder are actually a soft connection to the files in the/etc/init.d folder (similar to the shortcuts in Windows), that is, under the/etc/init.d folder is the full service program, and each RC ( 1-6). d only link it to its own boot needs the appropriate service program!
To start SCIM (a program), we first want to know where the SCIM program, with locate command can be found, SCIM in/usr/bin/scim here, where USR is the user's, bin in Linux represents the program can be executed. In this way, I can write a script, put it into the/etc/init.d, and then make a corresponding soft link in the RC5.D.
This script is actually very simple, just two lines:
#!/bin/bash
/usr/bin/scim
The first line is to declare what terminal runs the script, and the second line is the command to run.
It is also important to note that in RC5.D, each link name is the beginning of S or K, the start of the system is to start randomly, K start is not randomly started. In this way, you can know, if I want to start a random service, the first letter of its name K to the S can be, of course, the conversion of S to K, the service can not be started randomly. Therefore, I have to name this link sxxx, so that the system can let it start randomly.

Under RH, Rc.local is the last script file that is started by default, so
If you want to start randomly, there is another way to add/USR/BIN/SCIM to the tail of the rc.local, so you can

Transferred from: http://delmonkey.blog.163.com/blog/static/17875108120122153326877/

Linux system self-booting foot

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.