Send Linux-ha-cvs mailing list submissions to linux-ha-cvs@lists.linux-ha.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of Linux-ha-cvs digest..." Today's Topics: 1. Linux-HA CVS: ldirectord by horms from (linux-ha-cvs@lists.linux-ha.org) 2. Linux-HA CVS: ldirectord by horms from (linux-ha-cvs@lists.linux-ha.org) 3. Linux-HA CVS: ldirectord by horms from (linux-ha-cvs@lists.linux-ha.org) 4. Linux-HA CVS: ldirectord by horms from (linux-ha-cvs@lists.linux-ha.org) ---------------------------------------------------------------------- Message: 1 Date: Mon, 14 Aug 2006 21:58:39 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : horms Host : Project : linux-ha Module : ldirectord Dir : linux-ha/ldirectord Modified Files: ldirectord.in Log Message: Make checkcount global as well as per-virtual The documentatin lists checkcount as global, but actually the code only allows it to be per-virtual. This patch fixes this inconsistency by allowing checkcount to be global and overriden by a per-virtual setting, in the maner of checktimeout and friends. Signed-off-by: Simon Horman <[EMAIL PROTECTED]> =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- ldirectord.in 15 Aug 2006 03:57:58 -0000 1.11 +++ ldirectord.in 15 Aug 2006 03:58:38 -0000 1.12 @@ -1,5 +1,5 @@ #!/usr/bin/perl -my($VERSION)=(qw$Id: ldirectord.in,v 1.11 2006/08/15 03:57:58 horms Exp $)[2]; +my($VERSION)=(qw$Id: ldirectord.in,v 1.12 2006/08/15 03:58:38 horms Exp $)[2]; ###################################################################### # ldirectord http://www.vergenet.net/linux/ldirectord/ @@ -417,6 +417,7 @@ $NEGOTIATETIMEOUT $RUNPID $CHECKTIMEOUT + $CHECKCOUNT $QUIESCENT $EMAILALERT $EMAILALERTFREQ @@ -450,6 +451,7 @@ $AUTOCHECK = "no"; $CHECKINTERVAL = 10; $CHECKTIMEOUT = 5; +$CHECKCOUNT = 1; $CONNECTTIMEOUT = 0; $LDIRECTORD = ld_find_cmd("ldirectord", 1); if (! defined $LDIRECTORD) { @@ -832,7 +834,7 @@ $vsrv{database} = ""; $vsrv{checktimeout} = -1; $vsrv{connecttimeout} = -1; - $vsrv{checkcount} = 1; + $vsrv{checkcount} = -1; $vsrv{negotiatetimeout} = -1; $vsrv{num_connects} = 0; $vsrv{httpmethod} = "GET"; @@ -1026,6 +1028,10 @@ $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid check interval value"); $CHECKINTERVAL = $1; + } elsif ($_ =~ /^checkcount\s*=\s*(.*)/) { + $1 =~ /(\d+)/ && $1 or &config_error($line, + "invalid check count value"); + $CHECKCOUNT = $1; } elsif ($_ =~ /^fallback\s*=\s*(.*)/) { my $tcp = &ld_gethostservbyname($1, "tcp"); my $udp = &ld_gethostservbyname($1, "udp"); @@ -1525,6 +1531,9 @@ if ($$v{negotiatetimeout} < 0) { $$v{negotiatetimeout} = $$v{checktimeout}; } + if ($$v{checkcount} < 0) { + $$v{checkcount} = $CHECKCOUNT; + } } } ------------------------------ Message: 2 Date: Mon, 14 Aug 2006 21:59:35 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : horms Host : Project : linux-ha Module : ldirectord Dir : linux-ha/ldirectord Modified Files: ldirectord.in Log Message: Consolidate string handling in config_error Signed-off-by: Simon Horman <[EMAIL PROTECTED]> =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ldirectord.in 15 Aug 2006 03:58:38 -0000 1.12 +++ ldirectord.in 15 Aug 2006 03:59:35 -0000 1.13 @@ -1,5 +1,5 @@ #!/usr/bin/perl -my($VERSION)=(qw$Id: ldirectord.in,v 1.12 2006/08/15 03:58:38 horms Exp $)[2]; +my($VERSION)=(qw$Id: ldirectord.in,v 1.13 2006/08/15 03:59:35 horms Exp $)[2]; ###################################################################### # ldirectord http://www.vergenet.net/linux/ldirectord/ @@ -1446,18 +1446,16 @@ chomp($msg); $msg .= "\n"; + my $msg_prefix = "Error [$pid]"; + if ($line > 0) { + $msg_prefix .= " reading file $CONFIG at line $line"; + } + $msg = "$msg_prefix: $msg" + if ($opt_d || $initializing==1) { - if ($line>0) { - print STDERR "Error [$pid] reading file $CONFIG at line $line: $msg"; - } else { - print STDERR "Error: $msg\n"; - } + print STDERR $msg; } else { - if ($line>0) { - &ld_log("Error [$pid] reading file $CONFIG at line $line: $msg"); - } else { - &ld_log("Error: $msg\n"); - } + &ld_log("$msg"); } if ($initializing) { &ld_rm_file("$RUNPID.$CFGNAME.pid"); ------------------------------ Message: 3 Date: Mon, 14 Aug 2006 22:00:13 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : horms Host : Project : linux-ha Module : ldirectord Dir : linux-ha/ldirectord Modified Files: ldirectord.in Log Message: Add config_warn Signed-off-by: Simon Horman <[EMAIL PROTECTED]> =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- ldirectord.in 15 Aug 2006 03:59:35 -0000 1.13 +++ ldirectord.in 15 Aug 2006 04:00:12 -0000 1.14 @@ -1,5 +1,5 @@ #!/usr/bin/perl -my($VERSION)=(qw$Id: ldirectord.in,v 1.13 2006/08/15 03:59:35 horms Exp $)[2]; +my($VERSION)=(qw$Id: ldirectord.in,v 1.14 2006/08/15 04:00:12 horms Exp $)[2]; ###################################################################### # ldirectord http://www.vergenet.net/linux/ldirectord/ @@ -1439,24 +1439,41 @@ } -sub config_error +sub __config_log { - my ($line, $msg) = @_; + my ($line, $prefix, $msg) = @_; chomp($msg); $msg .= "\n"; - my $msg_prefix = "Error [$pid]"; + my $msg_prefix = "$prefix [$pid]"; if ($line > 0) { $msg_prefix .= " reading file $CONFIG at line $line"; } - $msg = "$msg_prefix: $msg" + $msg = "$msg_prefix: $msg"; - if ($opt_d || $initializing==1) { + if ($opt_d or $initializing==1) { print STDERR $msg; - } else { + } + else { &ld_log("$msg"); } +} + + +sub config_warn +{ + my ($line, $msg) = @_; + + __config_log($line, "Warning", $msg); +} + + +sub config_error +{ + my ($line, $msg) = @_; + + __config_log($line, "Error", $msg); if ($initializing) { &ld_rm_file("$RUNPID.$CFGNAME.pid"); &ld_exit(2, "config_error: Configuration Error"); ------------------------------ Message: 4 Date: Mon, 14 Aug 2006 22:01:27 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : horms Host : Project : linux-ha Module : ldirectord Dir : linux-ha/ldirectord Modified Files: ldirectord.in Log Message: Have the supervised directive take yes and no as arguments Other global switches, such as quiescent, take yes and no as their only valid options. Supervised however just has to be present, and can actually have any trailing garbage. This patch resolves this indescrepancy by allowing supervised to take yes and no as arguemnts. For backwards compatibility purposes, supervised followed by any ammount of whitespace (including none) is treated as "supervised = yes", and a warning is logged. supervised with trailing garbage is now an error. This patch also changes where $SUPERVISED is intialised from inside read_config, to global. This should not be a problem, but I am noting it here just in case. Signed-off-by: Simon Horman <[EMAIL PROTECTED]> =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- ldirectord.in 15 Aug 2006 04:00:12 -0000 1.14 +++ ldirectord.in 15 Aug 2006 04:01:26 -0000 1.15 @@ -1,5 +1,5 @@ #!/usr/bin/perl -my($VERSION)=(qw$Id: ldirectord.in,v 1.14 2006/08/15 04:00:12 horms Exp $)[2]; +my($VERSION)=(qw$Id: ldirectord.in,v 1.15 2006/08/15 04:01:26 horms Exp $)[2]; ###################################################################### # ldirectord http://www.vergenet.net/linux/ldirectord/ @@ -195,13 +195,13 @@ the named I<configuration>. -B<supervised> +B<supervised = >B<yes>|B<no> -If this directive is specified, the daemon does not go into background mode. +If I<yes>, then ldirectord does not go into background mode. All log-messages are redirected to stdout instead of a logfile. This is useful to run B<ldirectord> supervised from daemontools. See http://untroubled.org/rpms/daemontools/ or http://cr.yp.to/daemontools.html -for details. +for details. Default is no B<quiescent = >[B<yes>|B<no>] @@ -461,6 +461,7 @@ $LD_TERM_CALLED = 0; $NEGOTIATETIMEOUT = 0; $RUNPID = "/var/run/ldirectord"; +$SUPERVISED = "no"; $QUIESCENT = "yes"; @@ -689,7 +690,7 @@ } # Run as daemon - if ($SUPERVISED || $opt_d) { + if ($SUPERVISED eq "yes" || $opt_d) { &ld_log("Starting Linux Director v$VERSION with pid: $$"); } else { &ld_log("Starting Linux Director v$VERSION as daemon"); @@ -783,7 +784,6 @@ undef $CALLBACK; undef %LD_INSTANCE; undef $checksum; - $SUPERVISED = 0; $stattime = 0; my %virtual_seen; open(CFGFILE, "<$CONFIG") or @@ -1066,7 +1066,20 @@ } elsif ($_ =~ /^execute\s*=\s*(.*)/) { $LD_INSTANCE{$1} = 1; } elsif ($_ =~ /^supervised/) { - $SUPERVISED = 1; + if (($_ =~ /^supervised\s*=\s*(.*)/) and + ($1 eq "yes" || $1 eq "no")) { + $SUPERVISED = $1; + } + elsif ($_ =~ /^supervised\s*$/) { + $SUPERVISED = "yes"; + &config_warn($line, + "please update your config not to " . + "use a bare supervised directive"); + } + else { + &config_error($line, + "supervised must be 'yes' or 'no'"); + } } elsif ($_ =~ /^quiescent\s*=\s*(.*)/) { ($1 eq "yes" || $1 eq "no") or &config_error($line, @@ -3033,7 +3046,7 @@ # 1 on error sub ld_openlog { - if ($opt_d or $SUPERVISED) { + if ($opt_d or $SUPERVISED eq "yes") { # Instantly do nothing return(0); } @@ -3071,7 +3084,7 @@ chomp $message; if ($opt_d) { print STDERR "$message\n"; - } elsif ($SUPERVISED) { + } elsif ($SUPERVISED eq "yes") { print "[$now] $message\n"; } elsif ( $LDIRLOG =~ /^\/(.*)/ ) { unless (open(LOGFILE, ">>$LDIRLOG") ------------------------------ _______________________________________________ Linux-ha-cvs mailing list Linux-ha-cvs@lists.linux-ha.org http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs End of Linux-ha-cvs Digest, Vol 33, Issue 35 ********************************************