Great stuff - it missed the 3.2 release by hours, unfortunately.
Brent
First of all, I love this server! Thanks for making it.
I use the server on my clients machines to allow interactivity with my
server machines
because of its small footprint and the cleanliness of operation.
Ok, enough of the kudos. Here's some changes I made to make it work on
my Linux
platforms. Linux appears to have trouble with ports being closed.
attached are 2 files:
httpd.tcl :
-------
1) Use expect instead of tcl to use the "trap" function which allows
the script to exit the vwait loop.
There may be a simple way to do this in Tcl but I don't know it.
trap {
;# setting forever to any value is what disconnects the server
set forever 0
} SIGUSR1
2) write the pid out to a pid file so it can be used to kill the process
using SIGUSR1 gracefully.
For some reason on my system (Linux) the process name appears as
'3' rather that httpd.tcl
set fid [open /mydir/tclhttpd.pid w]
puts $fid [pid]
close $fid
tclhttpd.etc.init
-----------
1) kill using the pid file rather than a ps command. The init script
was creating
the server process with the name of '3' rather than httpd.tcl and
as a result
could not kill the server.
pid=`cat $PID_FILE`
2) kill using SIGUSR1 for a graceful halt of the server. This solves
the problem
of leaving the port open on Linux resulting in the inability to do
a restart of the
server without having to restart the computer.
kill -SIGUSR1 $pid 2>&1 /dev/null
--
Seth Birkholz
[EMAIL PROTECTED]
httpd.tcl
#!/bin/sh
#
# /etc/init.d/tclhttpd - Start/Stop the tcl httpd server
#
# This file lives in slightly different locations on different platforms:
# Solaris:
# IRIX:
# /etc/init.d/tclhttpd
# RedHat Linux:
# /etc/rc.d/init.d/tclhttpd
# HPUX:
# /sbin/init.d/tclhttpd
#
# The script also needs links from peer directories named
# rc2.d to start the server
# (e.g., make rc2.d/S80tclhttpd a link to ../init.d/tclhttpd)
# and in rc0.d to stop the server, create a link named rc0.d/K20tclhttpd
#
#
INSTALL=/my/install/dir
PATH=/usr/bin:/bin
TDIR=$INSTALL/bin
SCRIPT=httpd.tcl
PROG=$TDIR/$SCRIPT
CONFIG=$INSTALL/config/tclhttpd.rc
DOCROOT=$INSTALL/htdocs
PID_FILE=$INSTALL/log/tclhttpd.pid
case $1 in
'start')
if [ -f $PROG ]; then
$PROG -- -config $CONFIG -docRoot $DOCROOT &
fi
;;
'stop')
pid=`cat $PID_FILE`
if test "$pid"
then
echo "Stopping $PROG"
#NOTE: SIGUSR1 is SIGUSER1
kill -SIGUSR1 $pid 2>&1 /dev/null
fi
;;
'restart')
$0 stop
$0 start
;;
*)
echo "usage: $0 {start|stop}"
;;
esac