Skip to content

Commit

Permalink
Do not declare services to be down unless they're actually down.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Jan 7, 2012
1 parent 23d3f79 commit e952ac9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions wre/lib/WRE/Mysql.pm
Expand Up @@ -209,7 +209,6 @@ sub start {
my $count = 0;
my $success = 0;
my $config = $self->wreConfig;
$config->set("wreMonitor/mysqlAdministrativelyDown", 0);
my $host = WRE::Host->new(wreConfig => $config);
my $cmd = "mysql.server start --user=".$config->get("user");
`$cmd`; # catch command line output
Expand All @@ -218,6 +217,9 @@ sub start {
eval {$success = $self->ping };
$count++;
}
if ($success) {
$config->set("wreMonitor/mysqlAdministrativelyDown", 0);
}
return $success;
}

Expand All @@ -236,7 +238,6 @@ sub stop {
my $count = 0;
my $success = 1;
my $config = $self->wreConfig;
$config->set("wreMonitor/mysqlAdministrativelyDown", 1);
my $host = WRE::Host->new(wreConfig => $config);
my $cmd = "mysql.server stop";
`$cmd`; # catch command line output
Expand All @@ -245,6 +246,9 @@ sub stop {
eval {$success = $self->ping };
$count++;
}
if (!$success) {
$config->set("wreMonitor/mysqlAdministrativelyDown", 1);
}
return !$success;
}

Expand Down

0 comments on commit e952ac9

Please sign in to comment.