Skip to content
Permalink
Browse files

More config file sanity.

  • Loading branch information...
perlDreamer committed Jan 8, 2012
1 parent 6ead253 commit ccdb7efb085e403401f80b2045134dd214fe9420
Showing with 7 additions and 4 deletions.
  1. +7 −4 wre/lib/WRE/Nginx.pm
@@ -78,13 +78,11 @@ Note: The process that runs this command must be either root or the user specifi
sub start {
my $self = shift;
my $wreConfig = $self->wreConfig;
$wreConfig->set("wreMonitor/nginxAdministrativelyDown", 0);
my $host = WRE::Host->new(wreConfig=>$wreConfig);
unless ($wreConfig->get("nginx/port") > 1024 || $host->isPrivilegedUser) {
croak "You are not an administrator on this machine so you cannot start services with ports 1-1024.";
}
my $cmd = "";
$cmd = $wreConfig->getRoot("/prereqs/bin/nginx")." -c ".$wreConfig->getRoot("/etc/nginx.conf");
my $cmd = $wreConfig->getRoot("/prereqs/bin/nginx")." -c ".$wreConfig->getRoot("/etc/nginx.conf");
my $count = 0;
my $success = 0;
`$cmd`; # catch command line output
@@ -93,6 +91,9 @@ sub start {
eval {$success = $self->ping};
$count++;
}
if ($success) {
$wreConfig->set("wreMonitor/nginxAdministrativelyDown", 0);
}
return $success;
}

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

0 comments on commit ccdb7ef

Please sign in to comment.
You can’t perform that action at this time.