Creation of the CentOS boot-up script

Source: Internet
Author: User

One of my CentOS boot start scripts   One, switch to/etc/init.d/  II, make SH script vi andy.sh[plain] #!/bin/sh     #add For chkconfig   #chkconfig: 2345   #description: The description of the shell   #关于脚本的简短描述   #proce Ssname:andystart                     #第一个进程名, the rear setting will use   & when it starts nbsp;   #下面要启动服务的命令  /etc/init.d/mysqld start;  /ETC/INIT.D/HTTPD start;  /sbin/iptables-i input-p TCP--dport 80-j ACCEPT;  service iptables Save;  service iptables Restart;   Description: 2345 refers to the script's runlevel, that is, in 2345 of these 4 modes can be run, 234 are text interface, 5 is the graphical interface X70 refers to the script in the future boot sequence number, if the other program's boot sequence number is smaller than 70 (such as 44, 45), The script needs to wait until these programs are started before starting. 30 refers to the stop order number of the script when the system shuts down. Linux the shell script executes multiple commands in a way  1. Between each command, separated   explained: The execution of each command will not affect the execution of other commands. In other words, each command executes, but does not guarantee that each command will execute successfully.  2. && between each command   description: If the previous command executes successfully, the following command will be executed. This ensures that after all commands have been executed, the execution process is successful.  3. Between each command with | | Separating   Description: | | It means that only the preceding command fails to execute the next command until a successful command is executed.   Add executable permissions to the script: chmod +x andy.sh  Use the Chkconfig command to set the script to self-start: Chkconfig--add andy.sh Five, reboot a try it!

Creation of the CentOS boot script

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.