Q. I’m using Debian Linux for last 4 years. I’m not able to find out update-rc.d like command ( install and remove System-V style init script links) on Redhat enterprise Linux (RHEL 5). Can you specify equivalent command for the same task?
A. update-rc.d updates the System V style init script links /etc/rcrunlevel.d/NNname whose target is the script /etc/init.d/name. These links are run by init when it changes runlevels; they are generally used to start and stop system services such as daemons. runlevel is one of the runlevels supported by init, namely, 0123456789S, and NN is the two-digit sequence number that determines where in the sequence init will run the scripts. Please note that this program was designed for use in package maintainer scripts and, accordingly, has only the very limited functionality required by such scripts. System administrators are not encouraged to use update-rc.d to manage runlevels. They should edit the links directly or use runlevel editors such as sysv-rc-conf and bum instead.
Under RHEL / CentOS you use command called ntsysv or chkconfig.
Redhat ntsysv tool
ntsysv is a simple interface for configuring runlevel services which are also configurable through chkconfig. By default, it configures the current runlevel. Just type ntsysv and select service you want to run:
(Fig.01: ntsysv in action under Red Hat Linux)
Redhat chkconfig tool
chkconfig provides a simple command-line tool for maintaining the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories. chkconfig has five distinct functions: adding new services for management, removing services from management, listing the current startup information for services, changing the startup information for services, and checking the startup state of a particular service.
Add service called foo
This option adds a new service for management by chkconfig:
# chkconfig --add foo
Delete service called foo
The service is removed from chkconfig management, and any symbolic links in /etc/rc[0-6].d which pertain to it are removed:
# chkconfig --del foo
List status for foo service
This option lists all of the services which chkconfig knows about, and whether they are stopped or started in each runlevel.
# chkconfig --list foo
Turn on or off services:
# chkconfig foo on
# chkconfig foo off
# chkconfig --level 2 foo on
Note that –level 35 specifies run levels 3 and 5, so following will turn on httpd service for 3 and 5 only:
# chkconfig --level 35 httpd on