From abad3e9c0388ebd652f5e403c9b1c7144b881de6 Mon Sep 17 00:00:00 2001 From: HIROSE Masaaki Date: Mon, 21 Apr 2014 20:20:41 +0900 Subject: [PATCH] Add --perl-path option same as fluent-agent-lite.init and fluent-agent-lite.conf --- misc/start-fluent-agent-lite | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/misc/start-fluent-agent-lite b/misc/start-fluent-agent-lite index 70185b7..09467d7 100755 --- a/misc/start-fluent-agent-lite +++ b/misc/start-fluent-agent-lite @@ -19,6 +19,7 @@ MAIN: { GetOptions( \%arg, 'agent-path|a=s', + 'perl-path=s', 'tag-prefix=s', 'f|field-name=s', 'primary-server=s', @@ -80,10 +81,15 @@ MAIN: { pod2usage("Invalid option: requires --tag-file TAG=TARGET_FILE"); } - my $agent_path = exists $arg{'agent-path'} ? $arg{'agent-path'} : 'fluent-agent-lite'; + my $agent_path = exists $arg{'agent-path'} ? $arg{'agent-path'} : '/usr/local/fluent-agent-lite/bin/fluent-agent-lite'; + if (! -f $agent_path) { + pod2usage("No such file: $agent_path"); + } + my $perl_path = exists $arg{'perl-path'} ? $arg{'perl-path'} : 'perl'; debugf("agent path: %s", $agent_path); + debugf("perl path: %s", $perl_path); debugf("common: %s", join(' ', @opts_common)); debugf("target_file: %s", ddf(\@opts_target_file)); debugf("server: %s", join(' ', @opts_server)); @@ -93,7 +99,7 @@ MAIN: { ); for my $target_file (@opts_target_file) { - my @args = ($agent_path, @opts_common, @$target_file, @opts_server); + my @args = ($perl_path, $agent_path, @opts_common, @$target_file, @opts_server); $proclet->service( code => sub { exec { $args[0] } @args;