/ Zope / Apsis / Pound Mailing List / Archive / 2006 / 2006-01 / new contribution - pound init.d scripts

[ << ] [ >> ]

[ Pound and RSA ephemeral keys / Gaetan OFFREDO ... ] [ matching special characters / lars ... ]

new contribution - pound init.d scripts
"Sergio Freire" <sergio-s-freire(at)ptinovacao.pt>
2006-01-06 15:56:12 [ FULL ]
Hi again.

Please find attached two init scripts for /etc/rc.d/init.d:

-          one for pound 1.xx

-          one for pound 2.xx

 

They are almost equal.

As I have both versions installed on one machine I renamed the pound
binary from "pound" to "pound2". 

I don't know if you all and Robert prefer to keep the binary with the
same name in the final 2.0 release.

Anyway, feel free to add this into the next release, if you agree and
the way you prefer.

 

 

Syntax:

            usage: ./pound2_lb (start|stop|wstop|kill|restart|help)

 

            start - starts pound

            stop - sends a SIGTERM signal (kill)

            wstop - tries at least 5 times to kill it gently (SIGTERM)
and then kills it using the SIGKILL signal

            kill - kill its with SIGKILL

            restart - restart :-)

            help - syntax     

            

Anything feel free to comment :-)

Regards,

Sergio Freire
Attachments:  
text.html text/html 7337 Bytes
pound2_lb application/octet-stream 1071 Bytes
pound_lb application/octet-stream 1067 Bytes

Re: [Pound Mailing List] new contribution - pound init.d scripts
Ted Dunning <tdunning(at)veoh.com>
2006-01-07 02:44:37 [ FULL ]
Thanks.

I would recommend changing the kill line to:

        killall $POUND_BIN

just for people like me to accidentally on purpose save the script to 
/etc/init.d/pound.  Otherwise the script kills itself as well as the 
running pound.

For my contribution, here is a small TCL script which interfaces with 
the haPort mechanism.  The idea is that this script is run from the same 
script that starts the server being balanced just after the server 
starts accepting connections.  It then loads several URLs' contents in 
order to warm up the server and only after getting those pages 
advertises that the server is up.

This strategy helps avoids the problem of a server with a long startup 
timing out on initial requests.  It also helps with the similar problem 
if you are using substantial amounts of caching ... you may not want 
your server to handle full loads right off the bat.  Translating this 
into your favorite scripting language should be trivial.

I still don't think that the haPort strategy itself is failsafe and 
would rather see a polling of a priority server, but this will do just 
fine for now.  All of our main server run scripts now incorporate this 
watchdog.

    #!/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 (at) [ 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




Sergio Freire wrote:
[...]
[...]
Attachments:  
text.html text/html 3466 Bytes

MailBoxer