≡ Menu

update-rc.d like command on Redhat Enterprise / CentOS Linux

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:
# ntsysv
Sysv Service managment tool
(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

Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 4 comments… add one }

  • Tam Scollard October 4, 2010, 1:38 am

    What a excellent design you have. your weblog posts are pretty helpful too! Thank you :-D

  • LAHMAM Mostafa February 11, 2011, 4:11 pm

    I need to have how ta update ‘rc.d’; why?
    I m working on Centos5 and I have to execute the following commands:
    # ln -s /etc/init.d/abi /etc/rc2.d/S99abi
    #update-rc.d abi defaults 99

    The ‘abi’ is script written by Malcom A. Hussain-Gambles,William C. House
    I have try to use a ‘ntsysv’ but I dont no wish service to act.

    Can you help for this matter
    Best Regards

    M. LAHMAM

    • Ivan April 9, 2014, 3:12 pm

      Hello LAHMAM. I’m thinking that maybe you could try adding ‘chkconfig –add abi’ to /etc/rc.local or ‘chkconfig –add [full_path_to_abi_script]. If you don’t want any service to be added, you could try placing full_path_to_abi_script/abi_script_file_name into /etc/rc.local. Script needs to have +x permissions.

      Hope that helps. Let me know.

  • Axel March 13, 2013, 3:21 pm

    Your save me!!!. Thanks for the post.

Leave a Comment