activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1222650 - /activemq/trunk/assembly/src/release/bin/activemq
Date Fri, 23 Dec 2011 11:43:27 GMT
Author: dejanb
Date: Fri Dec 23 11:43:27 2011
New Revision: 1222650

URL: http://svn.apache.org/viewvc?rev=1222650&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3645 - shell script improvements

Modified:
    activemq/trunk/assembly/src/release/bin/activemq

Modified: activemq/trunk/assembly/src/release/bin/activemq
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/release/bin/activemq?rev=1222650&r1=1222649&r2=1222650&view=diff
==============================================================================
--- activemq/trunk/assembly/src/release/bin/activemq (original)
+++ activemq/trunk/assembly/src/release/bin/activemq Fri Dec 23 11:43:27 2011
@@ -90,15 +90,36 @@ if [ -z "$ACTIVEMQ_BASE" ] ; then
 fi
 
 # Active MQ configuration directory
-ACTIVEMQ_CONFIG_DIR="$ACTIVEMQ_BASE/conf"
+if [ -z "$ACTIVEMQ_CONFIG_DIR" ] ; then
+    ACTIVEMQ_CONFIG_DIR="$ACTIVEMQ_BASE/conf"
+fi
+
+# Configure a user with non root priviledges, if no user is specified do not change user
+if [ -z "$ACTIVEMQ_USER" ] ; then
+    ACTIVEMQ_USER=""
+fi
 
 # Active MQ configuration directory
 if [ -z "$ACTIVEMQ_DATA_DIR" ]; then
   ACTIVEMQ_DATA_DIR="$ACTIVEMQ_BASE/data"
 fi
 
+setCurrentUser(){
+   CUSER=`whoami 2>/dev/null`
+
+   # Solaris fix
+   if [ ! $? -eq 0 ]; then
+      CUSER=`/usr/ucb/whoami 2>/dev/null`
+   fi
+}
+
 if [ ! -d "$ACTIVEMQ_DATA_DIR" ]; then
-    mkdir $ACTIVEMQ_DATA_DIR
+   setCurrentUser
+   if ( [ -z "$ACTIVEMQ_USER" ] || [ "$ACTIVEMQ_USER" = "$CUSER" ] );then
+        mkdir $ACTIVEMQ_DATA_DIR
+   elif [ "`id -u`" = "0" ];then
+      su -c "mkdir $ACTIVEMQ_DATA_DIR" - $ACTIVEMQ_USER;
+   fi
 fi
 
 # Location of the pidfile
@@ -113,9 +134,6 @@ fi
 #JAVA_HOME=""
 JAVACMD="auto"
 
-# Configure a user with non root priviledges, if no user is specified do not change user
-ACTIVEMQ_USER=""
-
 # Set jvm memory configuration
 if [ -z "$ACTIVEMQ_OPTS_MEMORY" ] ; then
     ACTIVEMQ_OPTS_MEMORY="-Xms256M -Xmx1G"
@@ -161,7 +179,9 @@ ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_
 ACTIVEMQ_SUNJMX_CONTROL=""
 
 # Specify the queue manager URL for using "browse" option of sysv initscript
-ACTIVEMQ_QUEUEMANAGERURL="--amqurl tcp://localhost:61616"
+if [ -z "$ACTIVEMQ_QUEUEMANAGERURL" ]; then
+    ACTIVEMQ_QUEUEMANAGERURL="--amqurl tcp://localhost:61616"
+fi
 
 # Set additional JSE arguments
 ACTIVEMQ_SSL_OPTS="$SSL_OPTS"
@@ -174,7 +194,9 @@ ACTIVEMQ_SSL_OPTS="$SSL_OPTS"
 
 # ActiveMQ tries to shutdown the broker by jmx,
 # after a specified number of seconds send SIGKILL
-ACTIVEMQ_KILL_MAXSECONDS=30
+if [ -z "$ACTIVEMQ_KILL_MAXSECONDS" ]; then
+    ACTIVEMQ_KILL_MAXSECONDS=30
+fi
 
 ## END:DEFAULTCONFIG
 
@@ -322,21 +344,6 @@ if [ "${ACTIVEMQ_BASE}" != "${ACTIVEMQ_H
     ACTIVEMQ_CLASSPATH="${ACTIVEMQ_BASE}/conf;${ACTIVEMQ_CLASSPATH}"
 fi
 
-
-
-# ------------------------------------------------------------------------
-# HELPER FUNCTIONS
-
-
-setCurrentUser(){
-   CUSER=`whoami 2>/dev/null`
-
-   # Solaris fix
-   if [ ! $? -eq 0 ]; then
-      CUSER=`/usr/ucb/whoami 2>/dev/null`
-   fi
-}
-
 # Start the ActiveMQ JAR
 #
 #



Mime
View raw message