Starting Servers: Standalone and xinetd

 < Day Day Up > 



A server is a daemon that runs concurrently with your other programs, continually looking for a request for its services, either from other users on your system or from remote users connecting to your system through a network. When a server receives a request from a user, it starts up a session to provide its services. For example, if users want to download a file from your system, they can use their own FTP client to connect to your FTP server and start up a session. In the session, they can access and download files from your system. Your server needs to be running for a user to access its services. For example, if you set up a Web site on your system with HTML files, you must have the httpd Web server program running before users can access your Web site and display those files.

Starting Services Directly

You can start a server in several ways. One way is to do it manually from the command line by entering the name of the server program and its arguments. When you press ENTER, the server starts, although your command line prompt reappears. The server runs concurrently as you perform other tasks. To see if your server is running, you can use the service command with the status option.

# service httpd status

Alternatively, you can use the ps command with the -aux option to list all currently running processes. You should see a process for the server program you started. To refine the list, you can add a grep operation with a pattern for the server name you want. The second command lists the process for the Web server.

# ps -aux # ps -aux | grep 'httpd'

Starting and Stopping Services with Startup Scripts

On Red Hat Linux systems, you use special startup scripts to start and stop your server manually. These scripts are located in the /etc/rc.d/init.d directory and have the same names as the server programs. For example, the /etc/rc.d/init.d/httpd script with the start option starts the Web server. Using this script with the stop option stops it. Instead of using the complete pathname for the script, you can use the service command and the script name. The following commands are equivalent:

/etc/rc.d/init.d/httpd stop service httpd stop

Starting Services Automatically

Instead of manually executing all the server programs each time you boot your system, you can have your system automatically start the servers for you. You can do this in two ways, depending on how you want to use a server. You can have a server running continuously from the time you start your system until you shut it down, or you can have the server start only when it receives a request from a user for its services. If a server is being used frequently, you may want to have it running all the time. If it is used rarely, you may want the server to start only when it receives a request. For example, if you are hosting a Web site, your Web server is receiving requests all the time from remote users on the Internet. For an FTP site, however, you may receive requests infrequently, in which case you may want to have the FTP server start only when it receives a request. Of course, certain FTP sites receive frequent requests, which would warrant a continuously running FTP server.

Standalone Servers

A server that starts automatically and runs continuously is referred to as a standalone server. Red Hat uses the SysV Init procedure to start servers automatically whenever your system boots. This procedure uses special startup scripts for the servers located in the /etc/rc.d/init.d directory. Most Linux systems configure the Web server to start automatically and to run continuously by default. A script for it called httpd is in the /etc/rc.d/init.d directory.

xinetd Servers

To start the server only when a request for its services is received, you configure it using the xinetd daemon. If you add, change, or delete server entries in the /etc/xinetd files, you will have to restart the xinetd daemon for these changes to take effect. On Red Hat, you can restart the xinetd daemon using the /etc/rc.d/init.d/xinetd script with the restart argument, as shown here:

# service xinetd restart

You can also use the xinetd script to start and stop the xinetd daemon. Stopping effectively shuts down all the servers that the xinetd daemon manages (those listed in the /etc/xinetd.conf file or the xinetd.d directory).

# service xinetd stop # service xinetd start

You can also directly restart xinetd by stopping its process directly. To do this, you use the killall command with the -HUP signal and the name xinetd.

# killall -HUP xinetd
Tip 

Versions prior to Red Hat 7.0 used the inetd daemon (the term stands for the Internet Services Daemon) instead of xinetd. xinetd is meant to be the enhanced replacement for inetd. If you are upgrading from inetd, you can use the inetdconvert command to convert inetd entries into xinetd configurations.



 < Day Day Up > 



Red Hat(c) The Complete Reference
Red Hat Enterprise Linux & Fedora Edition (DVD): The Complete Reference
ISBN: 0072230754
EAN: 2147483647
Year: 2004
Pages: 328

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net