After all the system scripts have been run, your system is configured and all the necessary system services have been started. If you are using a runlevel other than 5, the final act of the initprocess is to launch the user shell, which on Linux is nearly always bash. The shell launches and you see a login prompt on the screen.
Controlling Services at Boot with Administrative Tools
As the master control file for system startup, /etc/inittaband its corresponding system of symbolic links control system services. You can manage /etc/inittaband 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 chkconfigconfiguration 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 chkconfigText-Based Command-Line Tool
Traditionally, the command-line tool chkconfighas been used to effect administration of the services and their associations in the different runlevels. chkconfigwas 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 chkconfigthrough the grepcommand 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, chkconfigcan display the value of offor onfor each service and each runlevel. The sample output shows only those services that are started in runlevel 5. The chkconfigcommand 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 apmdscript under /etc/rc.d/init.d) when using Fedora during runlevel 5, use chkconfiglike this:
# chkconfig --level 5 apmd on
You can then verify this action by again using grepon chkconfig'soutput like this:
# chkconfig --list | grep apmd
apmd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
The chkconfigcommand 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 -levelsoption. You would use the ntsysvor servicecommands 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.
ntsysvis a graphical interface you can use to access chkconfigand use a graphical interface. ntsysvis an ncurses-basedinterface, 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 ntsysvutility manages only which services are started in the current runlevel. Use the --leveloption to modify other runlevels.
When you have the ntsysvapplication 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
ntsysvis 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 --leveloption to modify other runlevels.
The Fedora tool setup is an ncurses-based menu for all the available ncurses-basedcommand-line configuration tools (see Figure 11.2). It can be used to access ntsysvand all the other command-line configuration tools.
FIGURE 11.2 Use the setupcommand's System Services item to access the ntsysvcommand.
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.
Running Services Through xinetd
The xinetddaemon is a replacement for inetd; it listens for requests for services on certain ports and starts those services as required. xinetdis called a super server because it controls other servers. Its purpose is to conserve resources by not running services when not needed. The xinetddaemon is more secure than the older inetd, offers better logging facilities than inetd, and can redirect service requests to another machine. It does not require the root user to start any services.
The configuration file for xinetdis found at /etc/xinetd.conf; configuration files for individual services are located in /etc/xinet.d/; the particulars of its format are covered in the man page for xinetd.conf, which also provides a sample file listing. Fedora provides the appropriate server RPM packages already configured to use xinetdif possible. If you are installing servers manually from source code, the included documentation describes the appropriate xinetdconfiguration. Services run under xinetdcannot be started and stopped in the same manner as the services run from scripts in /etc/rc.d/init.d; you must restart the xinetdservice itself and let it control those services.
Читать дальше