flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: FLUME-1948: plugins.d directory(ies) should be separately overridable, independent of FLUME_HOME
Date Mon, 15 Apr 2013 03:59:39 GMT
Updated Branches:
  refs/heads/trunk 4aaf4a3f8 -> 961b995a0


FLUME-1948: plugins.d directory(ies) should be separately overridable, independent of FLUME_HOME

(Mike Percy via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/961b995a
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/961b995a
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/961b995a

Branch: refs/heads/trunk
Commit: 961b995a0432a58d43a01a3ca537ecb153d99b22
Parents: 4aaf4a3
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Sun Apr 14 20:58:50 2013 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Sun Apr 14 20:58:50 2013 -0700

----------------------------------------------------------------------
 bin/flume-ng |   58 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 37 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/961b995a/bin/flume-ng
----------------------------------------------------------------------
diff --git a/bin/flume-ng b/bin/flume-ng
index ee86c95..22b95b8 100755
--- a/bin/flume-ng
+++ b/bin/flume-ng
@@ -182,7 +182,11 @@ global options:
   --conf,-c <conf>      use configs in <conf> directory
   --classpath,-C <cp>   append to the classpath
   --dryrun,-d           do not actually start Flume, just print the command
-  -Dproperty=value      sets a JDK system property value
+  --plugins-path <dirs> colon-separated list of plugins.d directories. See the
+                        plugins.d section in the user guide for more details.
+                        Default: \$FLUME_HOME/plugins.d
+  -Dproperty=value      sets a Java system property value
+  -Xproperty=value      sets a Java -X option
 
 agent options:
   --conf-file,-f <file> specify a config file (required)
@@ -235,6 +239,7 @@ LD_LIBRARY_PATH=""
 
 opt_conf=""
 opt_classpath=""
+opt_plugins_dirs=""
 opt_java_props=""
 opt_dryrun=""
 
@@ -268,6 +273,7 @@ case "$mode" in
     ;;
 esac
 
+args=""
 while [ -n "$*" ] ; do
   arg=$1
   shift
@@ -286,6 +292,10 @@ while [ -n "$*" ] ; do
     --dryrun|-d)
       opt_dryrun="1"
       ;;
+    --plugins-path)
+      opt_plugins_dirs=$1
+      shift
+      ;;
     -D*)
       opt_java_props="$opt_java_props $arg"
       ;;
@@ -336,35 +346,41 @@ else
   FLUME_CLASSPATH="${FLUME_HOME}/lib/*"
 fi
 
-# load plugins.d
-unset plugin_lib plugin_libext plugin_native
-PLUGINS_DIR=${FLUME_HOME}/plugins.d
-if [[ -d ${PLUGINS_DIR} ]]
-then
-  for plugin in ${PLUGINS_DIR}/*
-  do
-    if [[ -d $plugin/lib ]]
-    then
-      plugin_lib="${plugin_lib}${plugin_lib+:}${plugin}/lib/*"
-    fi 
-    if [[ -d $plugin/libext ]]
-    then
-      plugin_libext="${plugin_libext}${plugin_libext+:}${plugin}/libext/*"
-    fi 
-    if [[ -d $plugin/native ]]
-    then
-      plugin_native="${plugin_native}${plugin_native+:}${plugin}/native"
-    fi 
-  done
+# load plugins.d directories
+PLUGINS_DIRS=""
+if [ -n "${opt_plugins_dirs}" ]; then
+  PLUGINS_DIRS=$(sed -e 's/:/ /g' <<<${opt_plugins_dirs})
+else
+  PLUGINS_DIRS="${FLUME_HOME}/plugins.d"
 fi
+
+unset plugin_lib plugin_libext plugin_native
+for PLUGINS_DIR in $PLUGINS_DIRS; do
+  if [[ -d ${PLUGINS_DIR} ]]; then
+    for plugin in ${PLUGINS_DIR}/*; do
+      if [[ -d "$plugin/lib" ]]; then
+        plugin_lib="${plugin_lib}${plugin_lib+:}${plugin}/lib/*"
+      fi
+      if [[ -d "$plugin/libext" ]]; then
+        plugin_libext="${plugin_libext}${plugin_libext+:}${plugin}/libext/*"
+      fi
+      if [[ -d "$plugin/native" ]]; then
+        plugin_native="${plugin_native}${plugin_native+:}${plugin}/native"
+      fi
+    done
+  fi
+done
+
 if [[ -n "${plugin_lib}" ]]
 then
   FLUME_CLASSPATH="${FLUME_CLASSPATH}:${plugin_lib}"
 fi
+
 if [[ -n "${plugin_libext}" ]]
 then
   FLUME_CLASSPATH="${FLUME_CLASSPATH}:${plugin_libext}"
 fi
+
 if [[ -n "${plugin_native}" ]]
 then
   if [[ -n "${FLUME_JAVA_LIBRARY_PATH}" ]]


Mime
View raw message