You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by sn...@apache.org on 2015/04/21 02:29:31 UTC

incubator-ranger git commit: RANGER-247: modified init.d script and ranger-kms script names to be consistent with other packages

Repository: incubator-ranger
Updated Branches:
  refs/heads/master 0f56f8263 -> 853a932b3


RANGER-247: modified init.d script and ranger-kms script names to be consistent with other packages


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/853a932b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/853a932b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/853a932b

Branch: refs/heads/master
Commit: 853a932b3e17f08321ea49a39abe286bf4d52a61
Parents: 0f56f82
Author: sneethiraj <sn...@apache.org>
Authored: Mon Apr 20 20:26:24 2015 -0400
Committer: sneethiraj <sn...@apache.org>
Committed: Mon Apr 20 20:26:24 2015 -0400

----------------------------------------------------------------------
 kms/scripts/ranger-kms             | 140 +++++++++++++++++++-------------
 kms/scripts/ranger-kms-initd       |  76 +++++++++++++++++
 kms/scripts/ranger-kms-services.sh | 100 -----------------------
 kms/scripts/setup.sh               |   4 +-
 4 files changed, 160 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/853a932b/kms/scripts/ranger-kms
----------------------------------------------------------------------
diff --git a/kms/scripts/ranger-kms b/kms/scripts/ranger-kms
index f3a79f5..07c2910 100755
--- a/kms/scripts/ranger-kms
+++ b/kms/scripts/ranger-kms
@@ -15,62 +15,86 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-### BEGIN INIT INFO
-# Provides:        ranger-kms
-# Required-Start:  $local_fs $remote_fs $network $named $syslog $time
-# Required-Stop:   $local_fs $remote_fs $network $named $syslog $time
-# Default-Start:   2 3 4 5
-# Default-Stop:
-# Short-Description: Start/Stop Ranger kms
-### END INIT INFO
-
-LINUX_USER=kms
-BIN_PATH=/usr/bin
-MOD_NAME=ranger-kms
-
-pid=`ps -ef | grep java | grep -- '-Dproc_rangerkms' | grep -v grep | awk '{ print $2 }'`
-
-case $1 in
-start)
-	if [ "${pid}" != "" ]
-	then
-		echo "Ranger KMS Service is already running"
-		exit 1
-	else
-		echo "Starting Apache Ranger KMS."
-		/bin/su --login  $LINUX_USER -c "${BIN_PATH}/${MOD_NAME} start"
-	fi
-	;;
-stop)
-	if [ "${pid}" != "" ]
-	then
-		echo "Stopping Apache Ranger KMS."
-		/bin/su --login  $LINUX_USER -c "${BIN_PATH}/${MOD_NAME} stop"
-	else
-		echo "Ranger KMS Service is NOT running"
-		exit 1
-	fi
-	;;
-restart)
-	if [ "${pid}" != "" ]
-	then
-		echo "Stopping Apache Ranger KMS."
-		/bin/su --login  $LINUX_USER -c "${BIN_PATH}/${MOD_NAME} stop"
-		sleep 10
-	fi
+if [ -z "$1" ]
+then
+	echo "Invalid argument [$1];"
+	echo "Usage: Only start | stop | restart | version, are supported."
+	exit;
+fi
+action=$1
+
+realScriptPath=`readlink -f $0`
+realScriptDir=`dirname $realScriptPath`
+RANGER_KMS_DIR=`(cd $realScriptDir; pwd)`
+RANGER_KMS_EWS_DIR=${RANGER_KMS_DIR}/ews
+RANGER_KMS_EWS_CONF_DIR="${RANGER_KMS_EWS_DIR}/conf"
+RANGER_KMS_EWS_LIB_DIR="${RANGER_KMS_EWS_DIR}/lib"
+
+JAVA_OPTS=" ${JAVA_OPTS} -XX:MaxPermSize=256m -Xmx1024m -Xms1024m "
+
+for custom_env_script in `find ${RANGER_KMS_DIR}/ews/conf/ -name "ranger-kms-env*"`; do
+        if [ -f $custom_env_script ]; then
+                . $custom_env_script
+        fi
+done
+
+if [ "$JAVA_HOME" != "" ]; then
+        export PATH=$JAVA_HOME/bin:$PATH
+fi
+
+cd ${RANGER_KMS_EWS_DIR}
+
+if [ ! -d logs ]
+then
+        mkdir logs
+fi
+
+
+PROC_NAME=proc_rangerkms
+export PROC_NAME
+
+START_CLASS_NAME="org.apache.ranger.server.tomcat.EmbeddedServer"
+
+STOP_CLASS_NAME="org.apache.ranger.server.tomcat.StopEmbeddedServer"
+
+KMS_CONFIG_FILENAME=kms_webserver.properties
+
+TOMCAT_LOG_DIR=/var/log/ranger/kms
+
+TOMCAT_LOG_FILE=${TOMCAT_LOG_DIR}/catalina.out
+TOMCAT_STOP_LOG_FILE=${TOMCAT_LOG_DIR}/stop_catalina.out
+
+if [ ! -d ${TOMCAT_LOG_DIR} ]
+then
+	mkdir -p ${TOMCAT_LOG_DIR}
+fi
+
+KMS_CONF_DIR=${RANGER_KMS_EWS_DIR}/webapp/config/
+
+JAVA_OPTS="${JAVA_OPTS} -Dcatalina.base=${RANGER_KMS_EWS_DIR} -Dkms.config.dir=${KMS_CONF_DIR} -Dkms.log.dir=${TOMCAT_LOG_DIR} -cp ${RANGER_KMS_EWS_CONF_DIR}:${RANGER_KMS_EWS_LIB_DIR}/*:${RANGER_KMS_EWS_DIR}/webapp/lib/*:${JAVA_HOME}/lib/* "
+
+if [ "${action^^}" == "START" ]; then
+	echo "+ java -D${PROC_NAME} ${JAVA_OPTS} ${START_CLASS_NAME} ${KMS_CONFIG_FILENAME} "
+	java -D${PROC_NAME} ${JAVA_OPTS} ${START_CLASS_NAME} ${KMS_CONFIG_FILENAME} > ${TOMCAT_LOG_FILE} 2>&1 &
+	echo "Apache Ranger KMS has started."
+	exit
+elif [ "${action^^}" == "STOP" ]; then
+	java ${JAVA_OPTS} ${STOP_CLASS_NAME} ${KMS_CONFIG_FILENAME} > ${TOMCAT_STOP_LOG_FILE} 2>&1
+	echo "Apache Ranger KMS has been stopped."
+	exit
+elif [ "${action^^}" == "RESTART" ]; then
+	echo "Restarting Apache Ranger KMS"
+	java ${JAVA_OPTS} ${STOP_CLASS_NAME} ${KMS_CONFIG_FILENAME} > ${TOMCAT_STOP_LOG_FILE} 2>&1
+	echo "Apache Ranger KMS has been stopped."
 	echo "Starting Apache Ranger KMS."
-	/bin/su --login  $LINUX_USER -c "${BIN_PATH}/${MOD_NAME} start"
-	;;
-status)
-	if [ "${pid}" != "" ]
-	then
-		echo "Ranger KMS Service is  running [pid={$pid}]"
-	else
-		echo "Ranger KMS Service is  NOT running." 
-
-	fi
-	;;
-*)
-	echo "Invalid argument [$1]; Only start|stop|restart|status are supported."
-    exit 1
-esac
+	java -D${PROC_NAME} ${JAVA_OPTS} ${START_CLASS_NAME} ${KMS_CONFIG_FILENAME} > ${TOMCAT_LOG_FILE} 2>&1 &
+	echo "Apache Ranger KMS has started successfully."
+	exit
+elif [ "${action^^}" == "VERSION" ]; then
+	( cd ${RANGER_KMS_LIB_DIR} ; java -cp ranger-util-*.jar org.apache.ranger.common.RangerVersionInfo )
+	exit
+else 
+        echo "Invalid argument [$1];"
+        echo "Usage: Only start | stop | restart | version, are supported."
+        exit;
+fi

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/853a932b/kms/scripts/ranger-kms-initd
----------------------------------------------------------------------
diff --git a/kms/scripts/ranger-kms-initd b/kms/scripts/ranger-kms-initd
new file mode 100755
index 0000000..f3a79f5
--- /dev/null
+++ b/kms/scripts/ranger-kms-initd
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+### BEGIN INIT INFO
+# Provides:        ranger-kms
+# Required-Start:  $local_fs $remote_fs $network $named $syslog $time
+# Required-Stop:   $local_fs $remote_fs $network $named $syslog $time
+# Default-Start:   2 3 4 5
+# Default-Stop:
+# Short-Description: Start/Stop Ranger kms
+### END INIT INFO
+
+LINUX_USER=kms
+BIN_PATH=/usr/bin
+MOD_NAME=ranger-kms
+
+pid=`ps -ef | grep java | grep -- '-Dproc_rangerkms' | grep -v grep | awk '{ print $2 }'`
+
+case $1 in
+start)
+	if [ "${pid}" != "" ]
+	then
+		echo "Ranger KMS Service is already running"
+		exit 1
+	else
+		echo "Starting Apache Ranger KMS."
+		/bin/su --login  $LINUX_USER -c "${BIN_PATH}/${MOD_NAME} start"
+	fi
+	;;
+stop)
+	if [ "${pid}" != "" ]
+	then
+		echo "Stopping Apache Ranger KMS."
+		/bin/su --login  $LINUX_USER -c "${BIN_PATH}/${MOD_NAME} stop"
+	else
+		echo "Ranger KMS Service is NOT running"
+		exit 1
+	fi
+	;;
+restart)
+	if [ "${pid}" != "" ]
+	then
+		echo "Stopping Apache Ranger KMS."
+		/bin/su --login  $LINUX_USER -c "${BIN_PATH}/${MOD_NAME} stop"
+		sleep 10
+	fi
+	echo "Starting Apache Ranger KMS."
+	/bin/su --login  $LINUX_USER -c "${BIN_PATH}/${MOD_NAME} start"
+	;;
+status)
+	if [ "${pid}" != "" ]
+	then
+		echo "Ranger KMS Service is  running [pid={$pid}]"
+	else
+		echo "Ranger KMS Service is  NOT running." 
+
+	fi
+	;;
+*)
+	echo "Invalid argument [$1]; Only start|stop|restart|status are supported."
+    exit 1
+esac

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/853a932b/kms/scripts/ranger-kms-services.sh
----------------------------------------------------------------------
diff --git a/kms/scripts/ranger-kms-services.sh b/kms/scripts/ranger-kms-services.sh
deleted file mode 100755
index 07c2910..0000000
--- a/kms/scripts/ranger-kms-services.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-if [ -z "$1" ]
-then
-	echo "Invalid argument [$1];"
-	echo "Usage: Only start | stop | restart | version, are supported."
-	exit;
-fi
-action=$1
-
-realScriptPath=`readlink -f $0`
-realScriptDir=`dirname $realScriptPath`
-RANGER_KMS_DIR=`(cd $realScriptDir; pwd)`
-RANGER_KMS_EWS_DIR=${RANGER_KMS_DIR}/ews
-RANGER_KMS_EWS_CONF_DIR="${RANGER_KMS_EWS_DIR}/conf"
-RANGER_KMS_EWS_LIB_DIR="${RANGER_KMS_EWS_DIR}/lib"
-
-JAVA_OPTS=" ${JAVA_OPTS} -XX:MaxPermSize=256m -Xmx1024m -Xms1024m "
-
-for custom_env_script in `find ${RANGER_KMS_DIR}/ews/conf/ -name "ranger-kms-env*"`; do
-        if [ -f $custom_env_script ]; then
-                . $custom_env_script
-        fi
-done
-
-if [ "$JAVA_HOME" != "" ]; then
-        export PATH=$JAVA_HOME/bin:$PATH
-fi
-
-cd ${RANGER_KMS_EWS_DIR}
-
-if [ ! -d logs ]
-then
-        mkdir logs
-fi
-
-
-PROC_NAME=proc_rangerkms
-export PROC_NAME
-
-START_CLASS_NAME="org.apache.ranger.server.tomcat.EmbeddedServer"
-
-STOP_CLASS_NAME="org.apache.ranger.server.tomcat.StopEmbeddedServer"
-
-KMS_CONFIG_FILENAME=kms_webserver.properties
-
-TOMCAT_LOG_DIR=/var/log/ranger/kms
-
-TOMCAT_LOG_FILE=${TOMCAT_LOG_DIR}/catalina.out
-TOMCAT_STOP_LOG_FILE=${TOMCAT_LOG_DIR}/stop_catalina.out
-
-if [ ! -d ${TOMCAT_LOG_DIR} ]
-then
-	mkdir -p ${TOMCAT_LOG_DIR}
-fi
-
-KMS_CONF_DIR=${RANGER_KMS_EWS_DIR}/webapp/config/
-
-JAVA_OPTS="${JAVA_OPTS} -Dcatalina.base=${RANGER_KMS_EWS_DIR} -Dkms.config.dir=${KMS_CONF_DIR} -Dkms.log.dir=${TOMCAT_LOG_DIR} -cp ${RANGER_KMS_EWS_CONF_DIR}:${RANGER_KMS_EWS_LIB_DIR}/*:${RANGER_KMS_EWS_DIR}/webapp/lib/*:${JAVA_HOME}/lib/* "
-
-if [ "${action^^}" == "START" ]; then
-	echo "+ java -D${PROC_NAME} ${JAVA_OPTS} ${START_CLASS_NAME} ${KMS_CONFIG_FILENAME} "
-	java -D${PROC_NAME} ${JAVA_OPTS} ${START_CLASS_NAME} ${KMS_CONFIG_FILENAME} > ${TOMCAT_LOG_FILE} 2>&1 &
-	echo "Apache Ranger KMS has started."
-	exit
-elif [ "${action^^}" == "STOP" ]; then
-	java ${JAVA_OPTS} ${STOP_CLASS_NAME} ${KMS_CONFIG_FILENAME} > ${TOMCAT_STOP_LOG_FILE} 2>&1
-	echo "Apache Ranger KMS has been stopped."
-	exit
-elif [ "${action^^}" == "RESTART" ]; then
-	echo "Restarting Apache Ranger KMS"
-	java ${JAVA_OPTS} ${STOP_CLASS_NAME} ${KMS_CONFIG_FILENAME} > ${TOMCAT_STOP_LOG_FILE} 2>&1
-	echo "Apache Ranger KMS has been stopped."
-	echo "Starting Apache Ranger KMS."
-	java -D${PROC_NAME} ${JAVA_OPTS} ${START_CLASS_NAME} ${KMS_CONFIG_FILENAME} > ${TOMCAT_LOG_FILE} 2>&1 &
-	echo "Apache Ranger KMS has started successfully."
-	exit
-elif [ "${action^^}" == "VERSION" ]; then
-	( cd ${RANGER_KMS_LIB_DIR} ; java -cp ranger-util-*.jar org.apache.ranger.common.RangerVersionInfo )
-	exit
-else 
-        echo "Invalid argument [$1];"
-        echo "Usage: Only start | stop | restart | version, are supported."
-        exit;
-fi

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/853a932b/kms/scripts/setup.sh
----------------------------------------------------------------------
diff --git a/kms/scripts/setup.sh b/kms/scripts/setup.sh
index 4fb12c0..295a71d 100644
--- a/kms/scripts/setup.sh
+++ b/kms/scripts/setup.sh
@@ -462,7 +462,7 @@ setup_install_files(){
 
 	if [ -d /etc/init.d ]; then
 	    log "[I] Setting up init.d"
-	    cp ${INSTALL_DIR}/${RANGER_KMS} /etc/init.d/${RANGER_KMS}
+	    cp ${INSTALL_DIR}/${RANGER_KMS}.initd /etc/init.d/${RANGER_KMS}
 
 	    chmod ug+rx /etc/init.d/${RANGER_KMS}
 
@@ -522,7 +522,7 @@ setup_install_files(){
 	# Copy ranger-admin-services to /usr/bin
 	if [ ! \( -e /usr/bin/ranger-kms \) ]
 	then
-	  ln -sf ${INSTALL_DIR}/ranger-kms-services.sh /usr/bin/ranger-kms
+	  ln -sf ${INSTALL_DIR}/ranger-kms /usr/bin/ranger-kms
 	  chmod ug+rx /usr/bin/ranger-kms	
 	fi