Книга: Fedora™ Unleashed, 2008 edition

Controlling Services at Boot with Administrative Tools

Controlling Services at Boot with Administrative Tools

As the master control file for system startup, /etc/inittab and its corresponding system of symbolic links control system services. You can manage /etc/inittab and its symbolic links, using these graphical and nongraphical administrative tools:

chkconfig — A small script that helps you configure system services.

ntsysv — A graphical interface for the chkconfig configuration script.

system-config-services — A full graphical services configuration client. This application is found in the System Services/Sever settings menu as the Services menu item.

The following sections explain how to use all these administrative tools to configure and manage services in Fedora.

Using the chkconfig Text-Based Command-Line Tool

Traditionally, the command-line tool chkconfig has been used to effect administration of the services and their associations in the different runlevels. chkconfig was a major improvement over the process of configuring the symbolic links by hand. It is an effective, text-based command-line tool that you can use to display, diagnose, or change the starting or stopping of system services (as available under /etc/rc.d/init.d) in each runlevel.

For example, to list all services that are turned on in runlevel 5, you can pipe the output of chkconfig through the grep command like this:

# /sbin/chkconfig --list | grep '5:on' | sort
anacron 0:off 1:off 2:on  3:on  4:on 5:on 6:off
apmd    0:off 1:off 2:on  3:on  4:on 5:on 6:off
atd     0:off 1:off 2:off 3:on  4:on 5:on 6:off
autofs  0:off 1:off 2:off 3:on  4:on 5:on 6:off
canna   0:off 1:off 2:on  3:off 4:on 5:on 6:off
crond   0:off 1:off 2:on  3:on  4:on 5:on 6:off

Not all the output is shown here, but as you can see, chkconfig can display the value of off or on for each service and each runlevel. The sample output shows only those services that are started in runlevel 5. The chkconfig command can be used to reassign start or stop values for each runlevel and each service. As an example, to alter the scripts to start power management (controlled by the apmd script under /etc/rc.d/init.d) when using Fedora during runlevel 5, use chkconfig like this:

# chkconfig --level 5 apmd on

You can then verify this action by again using grep on chkconfig's output like this:

# chkconfig --list | grep apmd
apmd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

The chkconfig command does not start or stop a service; instead, it alters the scripts that start or stop a service, or it can report on the status of a service. It affects only the current runlevel by default; you can modify other runlevels by using the -levels option. You would use the ntsysv or service commands or run the daemons directly to actually start or stop services (as described later in this chapter). All these tools have useful man pages to refresh your memory of all the available options.

ntsysv is a graphical interface you can use to access chkconfig and use a graphical interface. ntsysv is an ncurses-based interface, meaning that it offers crude, block graphics and elements you can tab through and select by pressing the spacebar (see Figure 11.1).


FIGURE 11.1 The ntsysv utility manages only which services are started in the current runlevel. Use the --level option to modify other runlevels.

When you have the ntsysv application open, you can scroll through the list of services and toggle a service on or off by pressing the spacebar on the keyboard. When finished, use the Tab key to highlight the OK or Cancel button. Your changes are saved and used the next time Fedora is booted.

NOTE

ntsysv is simple to use and it's an excellent tool for a system without X, but it works for only the runlevel in which you are currently. Use the --level option to modify other runlevels.

The Fedora tool setup is an ncurses-based menu for all the available ncurses-based command-line configuration tools (see Figure 11.2). It can be used to access ntsysv and all the other command-line configuration tools.


FIGURE 11.2 Use the setup command's System Services item to access the ntsysv command.

Using the GUI-Based Service Configuration Tool

Fedora's developers have added GUIs to many text-only, command-line-based system administration tools as Linux has matured. These tools provide an easier-to-use interface and don't require memorization or lookup of command-line options. Fedora provides its own Service Configuration tool for the control and administration of services (see Figure 11.3). You can access the GUI menu selection from the System Settings/Server Settings menu, and then select Services. The command-line name of this tool is system-config-services.


FIGURE 11.3 The new Service Configuration tool enables you to select runlevels to edit, displays all the available services, and provides an explanation of what the service does.

Оглавление книги


Генерация: 1.095. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз