#!/usr/bin/tclsh
package require http
# handle command line arguments
if {$argc != 4} {
puts stderr "Usage: watchdog server-host server-port url-file haPort"
}
set host [lindex $argv 0]
set port [lindex $argv 1]
set urlFile [lindex $argv 2]
set haPort [lindex $argv 3]
# write a suicide note to make it easier to kill us
set f [open watchDog.pid w]
puts $f [pid]
close $f
# read the warmup URLs
set f [open $urlFile]
set urls {}
while {[gets $f url] >= 0} {
lappend urls $url
}
# access each in turn
foreach x $urls {
puts "getting http://$host:$port/$x"
set t [http::geturl http://$host:$port/$x]
puts " status = [http::status $t]"
http::cleanup $t
}
# callback for incoming connections
proc acceptConnection {s h p} {
puts "Connection from $h @ [ clock format [ clock seconds ] ]"
close $s
}
# start accepting connections ... this tells pound the server is ready
set s [socket -server acceptConnection $haPort ]
# never exit but do enter the event loop ... this is just a tcl-ism
set x 0
vwait x
Please find attached two init scripts for /etc/rc.d/init.d: - one for pound 1.xx - one for pound 2.xx
-- Ted Dunning Chief Scientist Veoh Networks