« blib/lib/Clustericious/Plugin/CommonRoutes.pm
↑ Summary
blib/lib/Clustericious/Plugin/PlugAuth.pm »
| 1 | package Clustericious::Command::nginx; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Clustericious::App; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Clustericious::Config; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use File::Path qw( mkpath ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use base 'Clustericious::Command'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Clustericious::Log; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use File::Which qw( which ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | # ABSTRACT: Clustericious command to stat nginx | ||||||||||
| 13 | 1 | our $VERSION = '1.29'; # VERSION | |||||||||
| 14 | |||||||||||
| 15 | |||||||||||
| 16 | 1 | __PACKAGE__->attr(description => <<EOT); | |||||||||
| 17 | Start an nginx web server. | ||||||||||
| 18 | EOT | ||||||||||
| 19 | |||||||||||
| 20 | 1 | __PACKAGE__->attr(usage => <<EOT); | |||||||||
| 21 | Usage $0: nginx -p <prefix> [...other nginx options] | ||||||||||
| 22 | Starts an nginx webserver. | ||||||||||
| 23 | Options are passed verbatim to the nginx executable. | ||||||||||
| 24 | EOT | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 27 | 0 | my($self, @args) = @_; | |||||||||
| 28 | 0 | my $app_name = $ENV{MOJO_APP}; | |||||||||
| 29 | 0 | my %args = @args; | |||||||||
| 30 | |||||||||||
| 31 | 0 | $self->app->init_logging; | |||||||||
| 32 | |||||||||||
| 33 | 0 | ▶ | my $prefix = $args{-p} or INFO "no prefix for nginx"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | mkpath "$prefix/logs"; | |||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | my $nginx = which('nginx') or LOGDIE "could not find nginx in $ENV{PATH}"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | DEBUG "starting $nginx @args"; | |||||||||
| 38 | 0 | system$nginx, @args; | |||||||||
| 39 | 0 | ▶ | die "'$nginx @args' Failed to execute: $!" if $? == -1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | ▶ | die "'$nginx @args' Killed with signal: ", $? & 127 if $? & 127; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 0 | ▶ | die "'$nginx @args' Exited with ", $? >> 8 if $? >> 8; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 1 | 1; | |||||||||
| 45 | |||||||||||
| 46 | __END__ | ||||||||||