T.R | Title | User | Personal Name | Date | Lines |
---|
9559.1 | | JRDV04::SURUGA | | Tue May 06 1997 20:56 | 1 |
| any idea ??
|
9559.2 | Can this be done with inetd? | IOSG::MARSHALL | | Wed May 07 1997 13:28 | 34 |
| I'm trying to do similar to .0, but using inetd rather than a permanently
running server initialised at boot time.
I added this line to /etc/services:
http 80/tcp
and this line to /etc/inetd.conf
http stream tcp nowait root /usr/opt/ns-home/httpd-ceroc/start httpd
Then I HUPped inetd. The .../start program is a simple shell script, viz:
cd /usr/opt/ns-home/bin/httpd
./ns-httpd -d /usr/opt/ns-home/httpd-ceroc/config $@
which was created by the FastTrack server admin program, and which before the
link-up with inetd worked perfectly well (ie it started the server and I could
connect to it from a Netscape client).
But attempting to initiate http connections with the inetd stuff in place gives
the error:
could not bind to port 80 (Address already in use)
which I guess either means I haven't set up the interaction between inetd and
ns-httpd correctly, or maybe ns-httpd just can't work with inetd?
If the former, what do I need to to fix it please? If the latter, I can
trivially use inittab with 'respawn' to start and maintain the server, but I'd
prefer to use inetd if possible; after all that's what it's there for!
NB I guess the required inittab line looks something like this (I haven't tried
it yet!), which may help .0:
httpd:3:respawn:/usr/opt/ns-home/httpd-ceroc/start > dev/console 2>&1
Thanks,
Scott
|
9559.3 | working with error message | JRDV04::SURUGA | | Thu May 08 1997 06:02 | 11 |
| >NB I guess the required inittab line looks something like this (I haven't tried
>it yet!), which may help .0:
> httpd:3:respawn:/usr/opt/ns-home/httpd-ceroc/start > dev/console 2>&1
I added similar to above and for start-admin in /etc/inittab. They seem
to work but as stated in .2, I get following error message at boot time.
could not bind to port 80 (Address already in use)
K. Suruga
|
9559.4 | FastTrack is not inetd-compatible | IOSG::MARSHALL | | Thu May 08 1997 06:40 | 12 |
| To answer my own inetd question, I found (using Altavista, of course :-):
http://webcompare.iworld.com/compare/netscapefasttrack.shtml
According to this page, FastTrack won't work with inetd (they go on to say you
wouldn't want a Web Server running off inetd anyway, but don't give a convincing
argument why!).
So I'll pursue the inittab angle.
.3: let me know if you solve the bind error, and I'll do likewise.
Scott
|
9559.5 | Anyone know a hack to make ns-httpd work with inetd? | IOSG::MARSHALL | | Thu May 08 1997 13:06 | 42 |
| I've figured out the reason this doesn't work with inittab/respawn is that the
started ns-httpd process kicks off some child 'worker' processes then dies. So
init tries to respawn it when in fact the server is still running, causing the
port errors. This may well also be what causes the inetd problems
I guess one could use 'once' instead of 'respawn' in inittab, but that defeats
the whole point of using init to ensure the server is restarted if it fails. So
at this point I'm out of ideas, unless someone has a solution/hack that enables
ns-httpd to work with inetd.
In the meantime, here's a hack to achieve the objective. Put this line in
/etc/inittab:
httpd:3:respawn:/usr/local/bin/httpd > dev/console 2>&1
Then put the shell script below in /usr/local/bin/httpd. Obviously you can play
around with filenames and locations. I haven't tested it all at this point, but
you get the idea...
Scott
#!/bin/ksh
# Script to restart a program if it fails. The script checks for the existence
# of a PID file; if the file is missing, or the PID it contains is not running,
# it will start the specified program (which should create or overwrite the PID
# file with the new process ID). The script then repeatedly checks the process,
# at a specified interval, and restarts it if it has failed.
# $1: name of program to run (including any arguments)
# $2: name of file in which program stores its PID
# $3: interval (in seconds) at which to check program status
# Hard-coded parameter values for http daemon
httpdir=/usr/opt/ns-home/httpd-ceroc
set $httpdir/start $httpdir/logs/pid 300
while true; do
if ! test -r $2 || ! ps $(<$2) > /dev/null; then
$1 &
fi
sleep $3
done
|
9559.6 | | IOSG::MARSHALL | | Mon May 12 1997 11:09 | 7 |
| To conclude this rather lonely notes stream:
It seems ns-httpd does not work with inetd, period.
I've now tested the script in .5 and it does what is required.
Scott
|