5 ways to configure at what runlevel daemons are started

There are a few ways to start (and stop) daemons at specific runlevels. For Fedora you could use modify how Apache (httpd) is started:

chkconfig --level 4 httpd on

This is a simple command line tool to tell the the startup facility to enable (on) the Apache (httpd) daemon at runlevel 4 (--level 4). Works great and fast, but the script httpd must have some parameters in the file to let chkconfig know what to do with it:

# chkconfig: 4 85 15
# description: Apache is a World Wide Web server. It is used to serve HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid

The lines chkconfig and description are mandatory. In this example, the chkconfig line tells the startup facility to start in runlevel 4, with a "priority" of 85. This priority can be seen with ls /etc/rc4.d. The numbers of the startup script represent the order of how they are started.

ln -s /etc/init.d/httpd /etc/rc4.d/S85httpd

A much simpler, more simplistic method to start Apache. This command symbolically links /etc/rc4.d/S85httpd to the startup script of Apache. Don't forget to also stop the daemons with this set of links:

ln -s /etc/init.d/httpd /etc/rc0.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc1.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc2.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc3.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc5.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc6.d/K15httpd

ntsysv

A text-based graphical menu to enable or disable services.

serviceconf and system-config-services

A graphical interface to enable or disable services.

About Consultancy Articles Contact




References Red Hat Certified Architect By Robert de Bock Robert de Bock
Curriculum Vitae By Fred Clausen +31 6 14 39 58 72
By Nelson Manning [email protected]