initial upload
This commit is contained in:
46
roles/apache_php/templates/usr_local_bin_fcgi-client
Normal file
46
roles/apache_php/templates/usr_local_bin_fcgi-client
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
use IO::Socket;
|
||||
use IO::Socket::UNIX;
|
||||
use lib '/usr/local/lib/nagios/plugins';
|
||||
use FCGI::Client;
|
||||
|
||||
GetOptions(
|
||||
'h|help' => \my $help,
|
||||
) or pod2usage();
|
||||
pod2usage() if $help;
|
||||
pod2usage() if @ARGV < 2;
|
||||
my ($fcgi_file, $uri, $query_string) = @ARGV;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(
|
||||
Type => SOCK_STREAM(),
|
||||
Peer => $fcgi_file
|
||||
) or die $!;
|
||||
|
||||
my $client = FCGI::Client::Connection->new( sock => $sock );
|
||||
my ( $stdout, $stderr ) = $client->request(
|
||||
+{
|
||||
REQUEST_METHOD => 'GET',
|
||||
REQUEST_URI => $uri,
|
||||
SCRIPT_FILENAME => "/a/b/c$uri",
|
||||
SCRIPT_NAME => $uri,
|
||||
QUERY_STRING => $query_string || '',
|
||||
},
|
||||
''
|
||||
);
|
||||
print STDERR $stderr if $stderr;
|
||||
print $stdout;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
fcgi-client -
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
$ fcgi-client foo.fcgi URI [foo=bar&hoge=fuga]
|
||||
Reference in New Issue
Block a user