Skip to content

Commit ccdb7ef

Browse files
committedJan 8, 2012
More config file sanity.
1 parent 6ead253 commit ccdb7ef

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed
 

‎wre/lib/WRE/Nginx.pm

+7-4
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,11 @@ Note: The process that runs this command must be either root or the user specifi
7878
sub start {
7979
my $self = shift;
8080
my $wreConfig = $self->wreConfig;
81-
$wreConfig->set("wreMonitor/nginxAdministrativelyDown", 0);
8281
my $host = WRE::Host->new(wreConfig=>$wreConfig);
8382
unless ($wreConfig->get("nginx/port") > 1024 || $host->isPrivilegedUser) {
8483
croak "You are not an administrator on this machine so you cannot start services with ports 1-1024.";
8584
}
86-
my $cmd = "";
87-
$cmd = $wreConfig->getRoot("/prereqs/bin/nginx")." -c ".$wreConfig->getRoot("/etc/nginx.conf");
85+
my $cmd = $wreConfig->getRoot("/prereqs/bin/nginx")." -c ".$wreConfig->getRoot("/etc/nginx.conf");
8886
my $count = 0;
8987
my $success = 0;
9088
`$cmd`; # catch command line output
@@ -93,6 +91,9 @@ sub start {
9391
eval {$success = $self->ping};
9492
$count++;
9593
}
94+
if ($success) {
95+
$wreConfig->set("wreMonitor/nginxAdministrativelyDown", 0);
96+
}
9697
return $success;
9798
}
9899

@@ -109,7 +110,6 @@ Note: The process that runs this command must be either root or the user specifi
109110
sub stop {
110111
my $self = shift;
111112
my $wreConfig = $self->wreConfig;
112-
$wreConfig->set("wreMonitor/modproxyAdministrativelyDown", 1);
113113
my $host = WRE::Host->new(wreConfig=>$wreConfig);
114114
unless ($wreConfig->get("nginx/port") > 1024 || $host->isPrivilegedUser) {
115115
croak "You are not an administrator on this machine so you cannot stop services with ports 1-1024.";
@@ -122,6 +122,9 @@ sub stop {
122122
$success = !(eval {$self->ping});
123123
$count++;
124124
}
125+
if ($success) {
126+
$wreConfig->set("wreMonitor/modproxyAdministrativelyDown", 1);
127+
}
125128
return $success;
126129
}
127130

0 commit comments

Comments
 (0)
Please sign in to comment.