In CentOS, there are two main ways to set the startup of a self-installed program. 1. add the startup program command to the/etc/rc. d/rc. local file. for example, set httpd to be started upon startup. #! /Bin/sh # Thisscriptwillbeexecuted * after * alltheotherinitscripts. # Youcanputy
In CentOS, there are two main ways to set the startup of a self-installed program.
1. add the startup program command to the/etc/rc. d/rc. local file. for example, set httpd to be started upon startup.
#!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here 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 prepared startup script to the/etc/rc. d/init. d/directory, and run the command chkconfig to set the startup. For example, we write the httpd script and put it in the/etc/rc. d/init. d/directory.
chkconfig --add httpdchkconfig httpd on
The command is set to boot.