line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Clustericious::Command::lighttpd; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1287
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
1
|
|
|
1
|
|
6
|
use Clustericious::Log; |
|
1
|
|
|
|
|
50
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
682
|
use Clustericious::App; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
7
|
1
|
|
|
1
|
|
20
|
use Clustericious::Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
8
|
1
|
|
|
1
|
|
5
|
use base 'Clustericious::Command'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
260
|
|
9
|
1
|
|
|
1
|
|
249
|
use File::Which qw( which ); |
|
1
|
|
|
|
|
762
|
|
|
1
|
|
|
|
|
248
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: Clustericious command to stat lighttpd |
12
|
|
|
|
|
|
|
our $VERSION = '1.27'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__PACKAGE__->attr(description => <<EOT); |
16
|
|
|
|
|
|
|
Start a lighttpd web server. |
17
|
|
|
|
|
|
|
EOT |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
__PACKAGE__->attr(usage => <<EOT); |
20
|
|
|
|
|
|
|
Usage $0: lighttpd -f <config file> [...other lighttpd options] |
21
|
|
|
|
|
|
|
Starts a lighttpd webserver. |
22
|
|
|
|
|
|
|
Options are passed verbatim to the lighttpd executable. |
23
|
|
|
|
|
|
|
EOT |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub run { |
26
|
0
|
|
|
0
|
1
|
|
my($self, @args) = @_; |
27
|
0
|
|
|
|
|
|
my $app_name = $ENV{MOJO_APP}; |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
my $lighttpd = which('lighttpd') or LOGDIE "could not find lighttpd in $ENV{PATH}"; |
30
|
0
|
|
|
|
|
|
DEBUG "starting $lighttpd @args"; |
31
|
0
|
|
|
|
|
|
system $lighttpd, @args; |
32
|
0
|
0
|
|
|
|
|
die "'$lighttpd @args' Failed to execute: $!" if $? == -1; |
33
|
0
|
0
|
|
|
|
|
die "'$lighttpd @args' Killed with signal: ", $? & 127 if $? & 127; |
34
|
0
|
0
|
|
|
|
|
die "'$lighttpd @args' Exited with ", $? >> 8 if $? >> 8; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=encoding UTF-8 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Clustericious::Command::lighttpd - Clustericious command to stat lighttpd |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 VERSION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
version 1.27 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SYNOPSIS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
% yourapp start |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Start a lighttpd web server. The lighttpd start and stop commands recognize these options |
60
|
|
|
|
|
|
|
in their configuration section: |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=over 4 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item pid_file |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The location to the pid file. This should usually be the same as the C<PidFile> directive |
67
|
|
|
|
|
|
|
in your lighttpd configuration. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=back |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 EXAMPLES |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 FCGI |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
See caveats below |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
--- |
78
|
|
|
|
|
|
|
% my $root = dir "@{[ home ]}/var/run"; |
79
|
|
|
|
|
|
|
% $root->mkpath(0,0700); |
80
|
|
|
|
|
|
|
% $root->subdir('document-root')->mkpath(0700); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
url: http://<%= $host %>:<%= $port %> |
83
|
|
|
|
|
|
|
start_mode: lighttpd |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
lighttpd: |
86
|
|
|
|
|
|
|
args: -f <%= $root %>/lighttpd.<%= $port %>.conf |
87
|
|
|
|
|
|
|
pid_file: <%= $root %>/lighttpd.<%= $port %>.pid |
88
|
|
|
|
|
|
|
autogen: |
89
|
|
|
|
|
|
|
filename: <%= $root %>/lighttpd.<%= $port %>.conf |
90
|
|
|
|
|
|
|
content: | |
91
|
|
|
|
|
|
|
server.bind = "<%= $host %>" |
92
|
|
|
|
|
|
|
server.port = <%= $port %> |
93
|
|
|
|
|
|
|
server.document-root = "<%= $root %>/document-root" |
94
|
|
|
|
|
|
|
server.pid-file = "<%= $root %>/lighttpd.<%= $port %>.pid" |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
server.modules += ( "mod_fastcgi" ) |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
fastcgi.server = ("/" => (( |
99
|
|
|
|
|
|
|
"bin-path" => "<%= $0 %> fastcgi", |
100
|
|
|
|
|
|
|
"check-local" => "disable", |
101
|
|
|
|
|
|
|
"fix-root-scriptname" => "enable", |
102
|
|
|
|
|
|
|
"socket" => "<%= $root %>/lighttpd.<%= $port %>.sock" |
103
|
|
|
|
|
|
|
)) |
104
|
|
|
|
|
|
|
) |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 CAVEATS |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
I was unable to get lighttpd to kill the FCGI processes and there are reports |
109
|
|
|
|
|
|
|
(see L<http://redmine.lighttpd.net/issues/2137>) of the PID file it generates |
110
|
|
|
|
|
|
|
disappearing. Because of the former limitation, the lighttpd tests for |
111
|
|
|
|
|
|
|
Clustericious are skipped by default (though they can be used by developers |
112
|
|
|
|
|
|
|
willing to manually kill the FCGI processes). |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Pull requests to Clustericious and / or documentation clarification would be |
115
|
|
|
|
|
|
|
greatly appreciated if someone manages to get it to work better! |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 SEE ALSO |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
L<Clustericious> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Original author: Brian Duggan |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Current maintainer: Graham Ollis E<lt>plicease@cpan.orgE<gt> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Contributors: |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Curt Tilmes |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Yanick Champoux |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This software is copyright (c) 2013 by NASA GSFC. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
138
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |