Re: :-) Squid as a Load Balancer, . . . Yes!

From: Daniel Rinehart <>
Date: Fri, 16 May 1997 16:25:37 -0400 (EDT)

> current host with the least load. How could I dynamically read that
> hostname into the Perl script as a variable each time the redirector is
> run? Or is Squid always going to read in that variable at startup when
> it spawns the redirector processes?

> Does anyone know if I can somehow just send a SIGHUP or some other SIG
> just to the redirectors alone and not the entire Squid cache? SIGUSR ??

        This very basic example might help someone to integrate the two
parts. In this case the main loop runs forever, like the standard
redirector. However, when the script receives a -USR1 it executes the code
in the main_loop then returns to the while(1) loop. Setting up a cron job
to kill -USR1 the script every so many minutes could then be used to
redefine what host the redirector is using.
        Please note this is untested with squid.

- Daniel R. <> []


sub main_loop {
    print "\nIn the main loop call number: ", $counter++, "\n";

$SIG{USR1} = \&main_loop;


$| = 1;

while (1) {
    print "." if ( ! ( $times++ % 1000 ) );
Received on Fri May 16 1997 - 13:26:09 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:35:12 MST