Friday, December 12, 2003

Init Script

What is an initscript service and how do I start and stop it?

Linux has several methods for running programs automatically, without direct input from the user. One of these methods is the SysV initscripts. Programs started by these initscripts are called initscript services or simply services. Every initscript service has a name associated with it. You can get a list of the services installed on a system using the chkconfig command:

chkconfig --list

An initscript service can be setup to run, or not run, automatically when the system is booted:

chkconfig  on

causes the service to start when the system is booted, and

chkconfig  off

causes the service to not be started when the system is booted. The chkconfig command does not immediately start or stop a service, it only changes what happens to the service at the next reboot. To immediately start, stop, or check the current status of a service, use the service command:

service start
service stop
service status

For more information on the chkconfig command, refer to the chkconfig man page. For more information on SYSV initscripts in general, refer to the documentation included in the initscripts RPM.