Linux command tips – How to Start and Stop Services in RHEL 5 and CentOS 5

puttyThis is part of my series, useful Linux commands and tips. Although there is a great GUI utility to simplify service administration, called Service Confiuration tool, in an environment that favors the command line equivalent, it would also be good to know those commands. These commands will require root level access.

Here are the commands:

# /sbin/service [name] start

starts the background service

# /sbin/service [name] stop 

stops the background service

# /sbin/service [name] restart

restarts the background service

# /sbin/service [name] status

displays the background service status

# /sbin/chkconfig --list

displays all the available services

# /sbin/chkconfig --level 345 [name] on

automatically runs the background service on the next startup

# /sbin/chkconfig --level 345 [name] off

removes the background service from the startup list

# /sbin/chkconfig [name] on

enables the on-demand service

# /sbin/chkconfig [name] off

disables the on-demand service

Tested with
Red Hat Enterprise Linux 5.0 – 5.4
CentOS 5.0 – 5.4

References
Linux Mail Server Setup and Howto Guide