Return-Path: X-Original-To: apmail-incubator-flume-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-flume-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5C2579E55 for ; Wed, 18 Apr 2012 15:17:48 +0000 (UTC) Received: (qmail 28585 invoked by uid 500); 18 Apr 2012 15:17:48 -0000 Delivered-To: apmail-incubator-flume-commits-archive@incubator.apache.org Received: (qmail 28497 invoked by uid 500); 18 Apr 2012 15:17:47 -0000 Mailing-List: contact flume-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flume-dev@incubator.apache.org Delivered-To: mailing list flume-commits@incubator.apache.org Received: (qmail 28490 invoked by uid 99); 18 Apr 2012 15:17:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2012 15:17:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2012 15:17:39 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4D457238890B; Wed, 18 Apr 2012 15:17:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1327540 - in /incubator/flume/trunk: bin/flume-ng conf/flume-env.sh.template Date: Wed, 18 Apr 2012 15:17:18 -0000 To: flume-commits@incubator.apache.org From: brock@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120418151718.4D457238890B@eris.apache.org> Author: brock Date: Wed Apr 18 15:17:17 2012 New Revision: 1327540 URL: http://svn.apache.org/viewvc?rev=1327540&view=rev Log: FLUME-1125: flume-ng script allows flume-env.sh to clobber some command-line arguments (Mike Percy via Brock Noland) Modified: incubator/flume/trunk/bin/flume-ng incubator/flume/trunk/conf/flume-env.sh.template Modified: incubator/flume/trunk/bin/flume-ng URL: http://svn.apache.org/viewvc/incubator/flume/trunk/bin/flume-ng?rev=1327540&r1=1327539&r2=1327540&view=diff ============================================================================== --- incubator/flume/trunk/bin/flume-ng (original) +++ incubator/flume/trunk/bin/flume-ng Wed Apr 18 15:17:17 2012 @@ -105,6 +105,7 @@ commands: global options: --conf,-c use configs in directory --classpath,-C append to the classpath + --dryrun,-d do not actually start Flume, just print the command -Dproperty=value sets a JDK system property value agent options: @@ -135,7 +136,7 @@ run_flume() { fi set -x - exec $JAVA_HOME/bin/java $JAVA_OPTS -cp "$FLUME_CLASSPATH" \ + $EXEC $JAVA_HOME/bin/java $JAVA_OPTS -cp "$FLUME_CLASSPATH" \ -Djava.library.path=$FLUME_JAVA_LIBRARY_PATH "$FLUME_APPLICATION_CLASS" $* } @@ -149,6 +150,9 @@ FLUME_JAVA_LIBRARY_PATH="" JAVA_OPTS="-Xmx20m" opt_conf="" +opt_classpath="" +opt_java_props="" +opt_dryrun="" mode=$1 shift @@ -188,11 +192,14 @@ while [ -n "$*" ] ; do ;; --classpath|-C) [ -n "$1" ] || error "Option --classpath requires an argument" 1 - FLUME_CLASSPATH=$1 + opt_classpath=$1 shift ;; + --dryrun|-d) + opt_dryrun="1" + ;; -D*) - JAVA_OPTS="${JAVA_OPTS} $arg" + opt_java_props="$opt_java_props $arg" ;; *) args="$args $arg" @@ -209,9 +216,31 @@ fi if [ -z "$opt_conf" ]; then warn "No configuration directory set! Use --conf to override." elif [ -f "$opt_conf/flume-env.sh" ]; then + info "Sourcing environment configuration script $opt_conf/flume-env.sh" source "$opt_conf/flume-env.sh" fi +# append command-line java options to stock or env script JAVA_OPTS +if [ -n "${opt_java_props}" ]; then + JAVA_OPTS="${JAVA_OPTS} ${opt_java_props}" +fi + +# prepend command-line classpath to env script classpath +if [ -n "${opt_classpath}" ]; then + if [ -n "${FLUME_CLASSPATH}" ]; then + FLUME_CLASSPATH="${opt_classpath}:${FLUME_CLASSPATH}" + else + FLUME_CLASSPATH="${opt_classpath}" + fi +fi + +# prepend flume jars to the specified classpath (if any) +if [ -n "${FLUME_CLASSPATH}" ] ; then + FLUME_CLASSPATH="${FLUME_HOME}/lib/*:$FLUME_CLASSPATH" +else + FLUME_CLASSPATH="${FLUME_HOME}/lib/*" +fi + # find java if [ -z "${JAVA_HOME}" ] ; then echo "Warning: JAVA_HOME not set!" @@ -234,13 +263,6 @@ if [ -z "${FLUME_HOME}" ] ; then FLUME_HOME=$(cd $(dirname $0)/..; pwd) fi -# Append to the classpath -if [ -n "${FLUME_CLASSPATH}" ] ; then - FLUME_CLASSPATH="${FLUME_HOME}/lib/*:$FLUME_CLASSPATH" -else - FLUME_CLASSPATH="${FLUME_HOME}/lib/*" -fi - # look for hadoop libs add_hadoop_paths @@ -249,6 +271,13 @@ if [ -n "$opt_conf" ]; then FLUME_CLASSPATH="$opt_conf:$FLUME_CLASSPATH" fi +# allow dryrun +EXEC="exec" +if [ -n "${opt_dryrun}" ]; then + warn "Dryrun mode enabled (will not actually initiate startup)" + EXEC="echo" +fi + # finally, invoke the appropriate command if [ -n "$opt_agent" ] ; then run_flume $FLUME_AGENT_CLASS $args Modified: incubator/flume/trunk/conf/flume-env.sh.template URL: http://svn.apache.org/viewvc/incubator/flume/trunk/conf/flume-env.sh.template?rev=1327540&r1=1327539&r2=1327540&view=diff ============================================================================== --- incubator/flume/trunk/conf/flume-env.sh.template (original) +++ incubator/flume/trunk/conf/flume-env.sh.template Wed Apr 18 15:17:17 2012 @@ -14,19 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. - -# If this file is is FLUME_CONF_DIR/flume-env.sh, it sourced during execution -# of the flume script and the flume-daemon.sh script. +# If this file is placed at FLUME_CONF_DIR/flume-env.sh, it will be sourced +# during Flume startup. # Enviroment variables can be set here. +#JAVA_HOME=/usr/lib/jvm/java-6-sun -#export JAVA_HOME=/usr/lib/jvm/java-6-sun - -#export JAVA_OPTS="-Xmx20m" - - -#Note that the conf directory is always included in the classpath. -#export FLUME_CLASSPATH="" +# Give Flume more memory +#JAVA_OPTS="-Xmx200m" +# Note that the Flume conf directory is always included in the classpath. +#FLUME_CLASSPATH=""