Vous êtes sur la page 1sur 2

11.2.3.

Using the chkconfig Utility

1 of 2

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterpri...

11.2.3. Using the chkconfig Utility


The chkconfig utility is a command line tool that allows you to specify in which runlevel to start a
selected service, as well as to list all available services along with their current setting. Note that
with the exception of listing, you must have superuser privileges to use this command.

11.2.3.1. Listing the Services


To display a list of system services (services from the /etc/rc.d/init.d/ directory, as well as
the services controlled by xinetd), either type chkconfig --list, or use chkconfig with no
additional arguments. You will be presented with an output similar to the following:

Each line consists of the name of the service followed by its status (on or off) for each of the seven
numbered runlevels. For example, in the listing above, NetworkManager is enabled in runlevel 2,
3, 4, and 5, while abrtd runs in runlevel 3 and 5. The xinetd based services are listed at the end,
being either on, or off.
To display the current settings for a selected service only, use chkconfig --list followed by
the name of the service:

For example, to display the current settings for the sshd service, type:

You can also use this command to display the status of a service that is managed by xinetd. In that
case, the output will only contain the information whether the service is enabled or disabled:

11.2.3.2. Enabling a Service


To enable a service in runlevels 2, 3, 4, and 5, type the following at a shell prompt as root:

For example, to enable the httpd service in these four runlevels, type:

2/23/2014 11:48 AM

11.2.3. Using the chkconfig Utility

2 of 2

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterpri...

To enable a service in certain runlevels only, add the --level option followed by numbers from 0
to 6 representing each runlevel in which you want the service to run:

For instance, to enable the abrtd service in runlevels 3 and 5, type:

The service will be started the next time you enter one of these runlevels. If you need to start the
service immediately, use the service command as described in Section 11.3.2, Starting a
Service (s3-services-running-running.html) .
Do not use the --level option when working with a service that is managed by xinetd, as it is
not supported. For example, to enable the rsync service, type:

If the xinetd daemon is running, the service is immediately enabled without having to manually
restart the daemon.

11.2.3.3. Disabling a Service


To disable a service in runlevels 2, 3, 4, and 5, type the following at a shell prompt as root:

For instance, to disable the httpd service in these four runlevels, type:

To disable a service in certain runlevels only, add the --level option followed by numbers from 0
to 6 representing each runlevel in which you do not want the service to run:

For instance, to disable the abrtd in runlevels 2 and 4, type:

The service will be stopped the next time you enter one of these runlevels. If you need to stop the
service immediately, use the service command as described in Section 11.3.3, Stopping a
Service (s3-services-running-stopping.html) .
Do not use the --level option when working with a service that is managed by xinetd, as it is
not supported. For example, to disable the rsync service, type:

If the xinetd daemon is running, the service is immediately disabled without having to manually
restart the daemon.

Copyright 2014 Red Hat, Inc.

2/23/2014 11:48 AM

Vous aimerez peut-être aussi