Installing a daemon under inetd

The usual way to install a daemon is to either run it from the bootstrap command file (for example /etc/rc) so that it runs continuously, or to set up the internet daemon (inetd) to run it when a call comes in.

There is a csh script to do all this for BSD systems, which should be run from the directory in which you have compiled the daemon.

Copy the daemon program or shell script ( httpd in this example) into a suitable directory such as /usr/etc/httpd. Protect it from anyone writing to it except root.

Put "http" in the /etc/services file, or use the name of a specific service of your own if you want to use have a special port number.

(Exceptions: on a NeXT, see using the NetInfomanager . On any machine running NIS (yellow pages), see specicial instructions ).

For example,

www 80/tcp # WorldWideWeb server Put a line in the internet daemon configuration file, /etc/inetd.conf. For example, www stream tcp nowait nobody /usr/etc/httpd httpd -l /private/adm/httpd-log.txt (That was all one line.) Here "www" is used as a link between the services file and inetd.conf: it could have been any identifier. "nobody" is the user name under which you want the daemon to run, which determines what privileges it has for example to read data. The inted.conf format varies from system to system so copy the format of other lines in your version.

Note: there seem to be, on the NeXT at least, a limit of 4 arguments passed across by inetd!When you have updated inted.conf, find out which process is running inetd, and send it a "HUP" signal. On BSD unix (For system V, use ps-el for ps aux) this looks like:

> ps aux | grep inetd | grep -v grep root 85 0.0 0.9 1.24M 304K ? S 0:01 /usr/etc/inetd > kill -HUP 85 >

Also remember for httpd:

You must make or copy a rule file /etc/httpd.conf, unless you have used the -r option to change its location, or -R to disable it.

The -r option tells the daemon which rule file to use. See rule files .

If a log file is required, make sure that the user name under which the daemon is run (the 5th field in the line above) has the right to write the file.

Test the server with the line mode browser by giving its address explicitly:

www http://myhost.dom.ain:80/junkdocumentname If it doesn't work, you have probably missed something. See notes on debugging .
Tim BL