crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs | LICENSE

commit 9dc6c1ffc517c8140ddc36208349121f305f69de
parent 59795206769652ca9498bbd2b1743136be4f3f0e
Author: finwo <finwo@pm.me>
Date:   Sat,  3 Jan 2026 19:37:44 +0100

2.54

Diffstat:
MChangeLog | 3+++
MMakefile | 2+-
Mdoc/xrctl.xml.5 | 78+++++++++++++++++++++++++++++++++++++++++-------------------------------------
Atest/xr-stdby/xr-is-live | 42++++++++++++++++++++++++++++++++++++++++++
4 files changed, 87 insertions(+), 38 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,6 @@ +2.54 [KK 2009-04-29] +- Stamped new STABLE version. + 2.53 [KK 2009-04-24] - test/xr-client-ping now can live without LWP::UserAgent. When this Perl module is not present, the script will fall back to wget/curl. diff --git a/Makefile b/Makefile @@ -1,7 +1,7 @@ # Top-level Makefile for XR # ------------------------- -VER = 2.53 +VER = 2.54 PREFIX = $(DESTDIR)/usr BINDIR = $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man diff --git a/doc/xrctl.xml.5 b/doc/xrctl.xml.5 @@ -23,28 +23,28 @@ distributed with the sources for a full description. <system> <!-- Path where the "xr" binary is searched, and zippers as "gzip" and "bzip2", and the "ps" command. Default is that xrctl - uses $PATH. --> + uses $PATH. --> <path>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin</path> <!-- "ps" command that shows the PID and command. On Solaris, use /usr/bin/ps -ef "pid comm" and on Linux/MacOSX use - /bin/ps -ax -o pid,command. Default is that xrctl guesses - the right command. Example: - <pscmd>/bin/ps ax -o pid,command</pscmd> --> + /bin/ps -ax -o pid,command. Default is that xrctl guesses + the right command. Example: + <pscmd>/bin/ps ax -o pid,command</pscmd> --> <!-- Use "logger" to add output to syslog or not? Logger will be used if the binary can be found, and if uselogger is true. --> <uselogger>true</uselogger> <!-- The default logger is the program "logger". Redefine here if - you like, for example to a piping logrotate program. Example: - <logger>clpipe /var/log/xr.clog</logger> - The default <logger> command is: logger -t xr.{service} --> + you like, for example to a piping logrotate program. Example: + <logger>clpipe /var/log/xr.clog</logger> + The default <logger> command is: logger -t xr.{service} --> <!-- If logger is NOT used, xrctl will manage log output. In that - case, specify the following: - - Where do logs get written? - <logdir>/var/log</logdir> - - How big may the logs become? Manipulated during "xrctl rotate". - <maxlogsize>100000</maxlogsize> - - How many history logs to keep? - <loghistory>10</loghistory> --> + case, specify the following: + - Where do logs get written? + <logdir>/var/log</logdir> + - How big may the logs become? Manipulated during "xrctl rotate". + <maxlogsize>100000</maxlogsize> + - How many history logs to keep? + <loghistory>10</loghistory> --> </system> <!-- Service descriptions: This section defines all balancing @@ -59,14 +59,19 @@ distributed with the sources for a full description. <name>ssh</name> <server> <!-- Type (tcp/http, here: tcp), and IP-address/port to bind - to. Use "0" for IP-address to bind to all interfaces. The - web interface will listen to localhost, port 20.001. --> + to. Use "0" for IP-address to bind to all interfaces. The + web interface will listen to localhost, port 20.001. --> <type>tcp</type> <address>0:20000</address> <webinterface>0:20001</webinterface> <!-- Clients may be idle for 30 minutes, then they are logged - out. --> - <clienttimeout>1800</clienttimeout> + out. But they must accept data from XR within 3 seconds, + the latter is the write timeout: --> + <clienttimeout>1800:3</clienttimeout> + + <!-- DNS entries are by default cached for 3600 sec (1 hour). + Change if you like, for example to half an hour: --> + <dnscachetimeout>1800</dnscachetimeout> </server> <!-- Back ends for the service. --> @@ -91,7 +96,7 @@ distributed with the sources for a full description. <server> <!-- Server binding. XR will listen to any IP interface, on port 20.010. It'll be an HTTP balancer. The web interface will - be on port 20.011. --> + be on port 20.011 and bound only to the local host address. --> <address>0:20010</address> <type>http</type> <webinterface>127.0.0.1:20011</webinterface> @@ -122,15 +127,15 @@ distributed with the sources for a full description. ends. When given, the scripts are run with the arguments: the client IP, and the back end (server:port), and the number of connections to that back end. A very simple script - /where/ever/activitystart might e.g. do: - echo Client $1 going to back end $2, $3 connections so far \ - >> /tmp/activity.log - A very simple script /where/ever/activityend might e.g. do: - echo Client $1 is done with back end $2 >> /tmp/activity.log - - onstart: is run when a client is about to be handled at a + /where/ever/activitystart might e.g. do: + echo Client $1 going to back end $2, $3 connections so far \ + >> /tmp/activity.log + A very simple script /where/ever/activityend might e.g. do: + echo Client $1 is done with back end $2 >> /tmp/activity.log + - onstart: is run when a client is about to be handled at a back end - - onend: is run after succesful termination - - onfail: is run after unsuccesful termination + - onend: is run after succesful termination + - onfail: is run after unsuccesful termination --> <onstart>/where/ever/activitystart</onstart> <onend>/where/ever/activityend</onend> @@ -154,22 +159,21 @@ distributed with the sources for a full description. softmaxconnrate (here: 150), then each connection is delayed for defertime microsecs (here: 1.000.000, one sec). - Finally, the entire balancer will be allowed to serve up - to 400 simultaneous connections. - --> + Finally, the entire balancer will be allowed to serve up + to 400 simultaneous connections. --> <timeinterval>2</timeinterval> <hardmaxconnrate>200</hardmaxconnrate> <softmaxconnrate>150</softmaxconnrate> <defertime>1000000</defertime> <maxconnections>400</maxconnections> - <!-- Let's add some more protection. When a user exceeds their - hard maxconn rate, "/path/to/program" will be invoked - with the IP as argument. That program may eg. call - iptables to block the client. There is also a tag - softmaxconnexcess (not shown here). --> - <hardmaxconnexcess>/path/to/program</hardmaxconnexcess> - + <!-- Let's add some more protection. When a user exceeds their + hard maxconn rate, "/path/to/program" will be invoked + with the IP as argument. That program may eg. call + iptables to block the client. There is also a tag + softmaxconnexcess (not shown here). --> + <hardmaxconnexcess>/path/to/program</hardmaxconnexcess> + </dosprotection> <http> diff --git a/test/xr-stdby/xr-is-live b/test/xr-stdby/xr-is-live @@ -0,0 +1,42 @@ +#!/usr/bin/perl + +use strict; + +die <<"ENDUSAGE" if ($#ARGV < 0); + +Usage: xr-is-live HOST [HOST...] + +Polls stated host(s) for live status. Exits with the number of unreachable +hosts. + +Sample usage: + xr-is-live onehost - checks if the one host is down + xr-is-live h1 h2 h3 h3 h5 - checks if this network is down (this can be + assumed when exit status is larger than 3) + +ENDUSAGE + +for my $h (@ARGV) { + next if fork(); + if (!testlive($h)) { + print ("$h is not reachable\n"); + exit (1); + } + exit (0); +} +my $ret = 0; +while (1) { + last if (wait() == -1); + $ret++ if ($?); +} + +print ("total $ret not reachable host(s)\n") if ($ret); +exit ($ret); + +sub testlive($) { + my $h = shift; + + system("ping -c3 -t1 '$h' >/dev/null") and return undef; + return 1; +} +