Skip to content

Commit

Permalink
More config file sanity.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Jan 8, 2012
1 parent 6ead253 commit ccdb7ef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions wre/lib/WRE/Nginx.pm
Expand Up @@ -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
Expand All @@ -93,6 +91,9 @@ sub start {
eval {$success = $self->ping};
$count++;
}
if ($success) {
$wreConfig->set("wreMonitor/nginxAdministrativelyDown", 0);
}
return $success;
}

Expand All @@ -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.";
Expand All @@ -122,6 +122,9 @@ sub stop {
$success = !(eval {$self->ping});
$count++;
}
if ($success) {
$wreConfig->set("wreMonitor/modproxyAdministrativelyDown", 1);
}
return $success;
}

Expand Down

0 comments on commit ccdb7ef

Please sign in to comment.