[[email protected] ~]# Chkconfig--list Show services that start automatically
[[email protected] ~]# chkconfig--add * * * Add boot auto-start * * * Service
[[email protected] ~]# chkconfig--del * * * Delete boot auto-start * * * Service
[[Email protected] ~]# Setup can configure commands in the Shell graphics terminal to select the service
[[email protected] ~]# NTSYSV in shell Terminal graphics Configuration Boot service command, option not more than that
Setup , rc.local and chkconfig can be set up in three different ways
First Kind
Enter the #setup command into the System service menu, select the service you want to start, such as httpd, then restart the machine or/etc/rc.d./init.d/httpd
Start
The second Kind
Put the boot command into the/etc/rc.d/rc.local file so that you can start the service automatically each time you start, for example, Apache, after compiling Apache, will generate the Apachectl file under the bin of the installation directory, this is a startup script, We just need to add this order to rc.local.
(SuSE has no rc.local.) SuSE can define its own scripts so that if you want to run your own scripts before and after switching the run level, you can create them individually:
/etc/init.d/before.local
/etc/init.d/after.local)
echo/usr/local/apache/bin/apachectl>>/etc/rc.d/rc.local,
The way to set up the service to start automatically is to include some scripts similar to the following in rc.local:
#sshd
/usr/local/sbin/sshd
#proftpd
/usr/local/sbin/proftpd
#apache
/home/apache/bin/apachectl Start
#mysql
/home/mysql/bin/safe_mysqld--port=3306 &
#start oracle8i Listener First
su-oracle-c ' lsnrctl start '
#start oracle8i
su-oracle-c ' Dbstart '
Third Kind
through the chkconfig directive.
Use the Chkconfig command to add a service to the operating levels of the system, as follows:
1 Create a startup script.
for apache,mysql,ssh Such software is self-brought, we just have to modify a little bit to support the chkconfig on it.
2 Modifying Scripts
we need to add 2 lines to the front of the script to support the Chkconfig command
# chkconfig:2345
#
# Description:automates A packet filtering firewall withipchains.
#
Chkconfig: The run level that is defined later to enable the start service (for example, to enable 2345 to start the service), and the order in which services are closed and started (the order in which the services are turned off in the example above 8, the order in which the startup is started)
Descriptions: Description of the change service (the above example is the IPChains packet filter), you can replace the desired
After you modify it, execute it.
cp your script/etc/rc.d/init.d/script name
chmod 700/etc/rc.d/init.d/Script name
chkconfig--add Script name
For example:
Add it to the Linux boot process and run only at level 3, levels 5
[email protected] init.d]/sbin/chkconfig--add apache-httpd
[email protected] init.d]/sbin/chkconfig--level Apache-httpdon
after that, the service will be started and shut down automatically every time you restart the server.