I use the directory /usr/tclhttpd3.4.1 for the tclhttpd server
I put this script in /etc/init.d directory (I use Debian) and named it
tclhttpd
#!/bin/sh
PATH=/usr/bin:/bin
TDIR=/usr/tclhttpd3.4.1/bin
SCRIPT=httpd.tcl
PROG=$TDIR/$SCRIPT
case $1 in
'start')
if [ -f $PROG ]; then
$PROG &
fi
;;
'stop')
pid=`cat /var/run/tclhttpd.pid`
if test "$pid"
then
echo "Stopping $PROG"
kill $pid
fi
;;
'restart')
$0 stop
$0 start
;;
*)
echo "usage: $0 {start|stop}"
;;
#####
Made /etc/rc2.d/S80tclhttpd a link to /etc/init.d/tclhttpd
and in /etc/rc0.d to stop the server, create a link named rc0.d/K20tclhttpd
In the httpd.tcl script I added the following lines as Brent adviced
#httpd.tcl
set pidfile [open /var/run/tclhttpd.pid w]
puts $pidfile [pid]
close $pidfile
Thank you all for your help
Alexander Antonakakis
|