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

Using /etc/rc.d/init.d/httpd

Using /etc/rc.d/init.d/httpd

Fedora uses the scripts in the /etc/rc.d/init.d directory to control the startup and shut down of various services, including the Apache web server. The main script installed for the Apache web server is /etc/rc.d/init.d/httpd, although the actual work is done by the apachectl shell script included with Apache.

NOTE

/etc/rc.d/init.d/httpd is a shell script and isn't the same as the Apache server located in /usr/sbin. That is, /usr/sbin/httpd is the program executable file (the server); /etc/rc.d/init.d/httpd is a shell script that uses another shell script, apachectl, to control the server. See Chapter 11 for a description of some service scripts under /etc/rc.d/init.d and how the scripts are used to manage services such as httpd.

You can use the /etc/rc.d/init.d/httpd script and the following options to control the web server:

start — The system uses this option to start the web server during bootup. You, as root, can also use this script to start the server.

stop — The system uses this option to stop the server gracefully. You should use this script, rather than the kill command, to stop the server.

reload — You can use this option to send the HUP signal to the httpd server to have it reread the configuration files after modification.

restart — This option is a convenient way to stop and then immediately start the web server. If the httpd server isn't running, it is started.

condrestart — The same as the restart parameter, except that it restarts the httpd server only if it's actually running.

status — This option indicates whether the server is running; if it is, it provides the various PIDs for each instance of the server.

For example, to check on the status of your server, use the command

# /etc/rc.d/init.d/httpd status

This prints the following for me:

httpd (pid 15997 1791 1790 1789 1788 1787 1786 1785 1784 1781) is running...

This indicates that the web server is running; in fact, 10 instances of the server are currently running in this configuration.

In addition to the previous options, the httpd script also offers these features:

help — Prints a list of valid options to the httpd script (which are passed onto the server as if called from the command line).

configtest — A simple test of the server's configuration, which reports Status OK if the setup is correct. You can also use httpd's -t option to perform the same test, like this:

# httpd -t

fullstatus — Displays a verbose status report.

graceful — The same as the restart parameter, except that the configtest option is used first and open connections are not aborted.

TIP

Use the reload option if you're making many changes to the various server configuration files. This saves time when you're stopping and starting the server by having the system simply reread the configuration files.

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


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