*** ldirectord.in.orig Fri Jul 13 15:11:55 2012 --- ldirectord.in Fri Jul 13 15:15:04 2012 *************** *** 529,538 **** --- 529,542 ---- exit code conventions are identical to checktype external. That is, an external-perl checktype should also work as an external checktype. Default: /bin/true + BIB<"> + + If this value is set, it is passed as an extra fifth argument to checkcommand. + BI Number of port to monitor. Sometimes check port differs from service port. Default: port specified for each real server *************** *** 1338,1347 **** --- 1342,1352 ---- } $vsrv{addressfamily} = $af; $vsrv{real} = \@rsrv; $vsrv{scheduler} = "wrr"; $vsrv{checkcommand} = "/bin/true"; + $vsrv{checkarg} = undef; $vsrv{request} = "/"; $vsrv{receive} = ""; $vsrv{login} = ""; $vsrv{passwd} = ""; $vsrv{database} = ""; *************** *** 1391,1400 **** --- 1396,1408 ---- &config_error($line, "checktype must be \"connect\", \"negotiate\", \"on\", \"off\", \"ping\", \"external\", \"external-perl\" or a positive number"); } } elsif ($rcmd =~ /^checkcommand\s*=\s*\"(.*)\"/ or $rcmd =~ /^checkcommand\s*=\s*(.*)/){ $1 =~ /(.+)/ or &config_error($line, "invalid check command"); $vsrv{checkcommand} = $1; + } elsif ($rcmd =~ /^checkarg\s*=\s*\"(.*)\"/ or $rcmd =~ /^checkarg\s*=\s*(.*)/){ + $1 =~ /(.+)/ or &config_error($line, "invalid check arg"); + $vsrv{checkarg} = $1; } elsif ($rcmd =~ /^checktimeout\s*=\s*(.*)/){ $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid check timeout"); $vsrv{checktimeout} = $1; } elsif ($rcmd =~ /^connecttimeout\s*=\s*(.*)/){ &config_error($line, *************** *** 3257,3269 **** $v_server = $$v{server}; } else { $v_server = $$v{fwm}; } ! my $result = system_timeout($$v{checktimeout}, ! $$v{checkcommand}, $v_server, $$v{port}, ! $$r{server}, $$r{port}); if ($result) { &service_set($v, $r, "down", {do_log => 1}); &ld_debug(3, "Deactivated service $$r{server}:$$r{port}: " . "$@ after calling $$v{checkcommand} with result " . --- 3265,3278 ---- $v_server = $$v{server}; } else { $v_server = $$v{fwm}; } ! my @args = ($$v{checktimeout}, $$v{checkcommand}, ! $v_server, $$v{port}, $$r{server}, $$r{port}); ! push(@args, $$v{checkarg}) if (defined($$v{checkarg})); ! my $result = system_timeout(@args); if ($result) { &service_set($v, $r, "down", {do_log => 1}); &ld_debug(3, "Deactivated service $$r{server}:$$r{port}: " . "$@ after calling $$v{checkcommand} with result " . *************** *** 3302,3312 **** no warnings 'redefine'; local *CORE::GLOBAL::exit = sub { $result = shift; goto external_exit; }; ! $cmdfunc->($v_server, $$v{port}, $$r{server}, $$r{port}); external_exit: alarm 0; }; if ($@ or $result != 0) { &service_set($v, $r, "down"); --- 3311,3323 ---- no warnings 'redefine'; local *CORE::GLOBAL::exit = sub { $result = shift; goto external_exit; }; ! my @args = ($v_server, $$v{port}, $$r{server}, $$r{port}); ! push(@args, $$v{checkarg}) if (defined($$v{checkarg})); ! $cmdfunc->(@args); external_exit: alarm 0; }; if ($@ or $result != 0) { &service_set($v, $r, "down");