Under the CentOS system, there are two main ways to set up your own installed programs to boot.
1, the start of the program to add the command to the/etc/rc.d/rc.local file, such as the following is the setting up boot httpd.
#!/bin/sh # This script would be executed *after* all the other
init scripts.
# You can put your own initialization stuff in-if you don ' t # want to do the full
Sys V style init stuff.
Touch/var/lock/subsys/local
/usr/local/apache/bin/apachectl Start
2, add the written startup script to the directory/etc/rc.d/init.d/, and then use the command chkconfig to set the boot up.
Chkconfig function Description: Check, set up the system of various services.
Syntax: chkconfig [--add][--del][--list][system Services] or Chkconfig [--level < rank code >][system Services][on/off/reset]
--add Add Service
--del Delete Service
--list View each service startup status
For example, we set the self-boot mysql:
#将mysql启动脚本放入所有脚本运行目录/ETC/RC.D/INIT.D in
cp/lamp/mysql-5.0.41/support-files/mysql.server/etc/rc.d/init.d/ Mysqld
#改变权限
chown root.root/etc/rc.d/init.d/mysqld
#所有用户都可以执行, only root can modify
chmod 755/etc/rc.d/ Init.d/mysqld
#将mysqld into the Linux boot management system
chkconfig--add mysqld
#查看全部服务在各运行级状态
chkconfig--list mysqld
#只要运行级别3启动, all others close
chkconfig--levels 245 mysqld off
For example: We write the httpd script and put it into the/etc/rc.d/init.d/directory, using
Chkconfig--add httpd
chkconfig httpd on
The command is set to boot.
3, the start of the program to add the command to the/etc/rc.d/rc.sysinit file
Script/etc/rc.d/rc.sysinit, complete system service program startup, such as system environment variable setting, setting system clock, loading font, checking loading file system, generating system startup information log file, etc.
For example, we set up self-booting Apache:
echo "/usr/local/apache2/bin/apachectl start" >>/etc/rc.d/rc.sysinit
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.