You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2015/02/04 18:04:54 UTC
[5/9] incubator-ranger git commit: RANGER-210: Added ranger-admin and
ranger-usersync binaries which supports the following options : start | stop
| restart | version
RANGER-210: Added ranger-admin and ranger-usersync binaries which supports the following options : start | stop | restart | version
Signed-off-by: sneethiraj <sn...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/adbc5e88
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/adbc5e88
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/adbc5e88
Branch: refs/heads/stack
Commit: adbc5e88a13840d8132ed5b5fabf0a4b02468f95
Parents: 25517f0
Author: Gautam Borad <gb...@gmail.com>
Authored: Mon Feb 2 14:37:51 2015 +0530
Committer: sneethiraj <sn...@apache.org>
Committed: Tue Feb 3 00:31:47 2015 -0500
----------------------------------------------------------------------
embeddedwebserver/scripts/ranger-admin | 17 ++-
.../scripts/ranger-admin-services.sh | 79 +++++++++++
embeddedwebserver/scripts/start-ranger-admin.sh | 49 -------
embeddedwebserver/scripts/stop-ranger-admin.sh | 48 -------
pom.xml | 1 +
ranger-util/.gitignore | 1 +
ranger-util/pom.xml | 135 +++++++++++++++++++
.../org/apache/ranger/common/package-info.java | 26 ++++
.../ranger/common/RangerVersionAnnotation.java | 83 ++++++++++++
.../apache/ranger/common/RangerVersionInfo.java | 135 +++++++++++++++++++
ranger-util/src/scripts/saveVersion.sh | 109 +++++++++++++++
security-admin/pom.xml | 5 +
security-admin/scripts/setup.sh | 5 +-
src/main/assembly/usersync.xml | 1 +
ugsync/pom.xml | 12 +-
unixauthservice/scripts/initd | 16 ++-
.../scripts/ranger-usersync-services.sh | 111 +++++++++++++++
unixauthservice/scripts/setup.sh | 4 +
unixauthservice/scripts/start.sh | 61 ---------
unixauthservice/scripts/stop.sh | 46 -------
20 files changed, 724 insertions(+), 220 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/embeddedwebserver/scripts/ranger-admin
----------------------------------------------------------------------
diff --git a/embeddedwebserver/scripts/ranger-admin b/embeddedwebserver/scripts/ranger-admin
index b1ef4f5..f916dbb 100755
--- a/embeddedwebserver/scripts/ranger-admin
+++ b/embeddedwebserver/scripts/ranger-admin
@@ -24,20 +24,23 @@
# Short-Description: Start/Stop Ranger Admin
### END INIT INFO
-LINUX_USER=ranger
BIN_PATH=/usr/bin
+MOD_NAME=ranger-admin
case $1 in
start)
- /bin/su --login $LINUX_USER "${BIN_PATH}/ranger-admin-start"
+ echo "Starting Apache Ranger Admin."
+ ${BIN_PATH}/${MOD_NAME} start
;;
stop)
- /bin/su --login $LINUX_USER "${BIN_PATH}/ranger-admin-stop"
- ;;
+ echo "Stopping Apache Ranger Admin."
+ ${BIN_PATH}/${MOD_NAME} stop
+ ;;
restart)
- /bin/su --login $LINUX_USER "${BIN_PATH}/stop-ranger-admin.sh" && sleep 30
- /bin/su --login $LINUX_USER "${BIN_PATH}/start-ranger-admin.sh"
-
+ echo "Stopping Apache Ranger Admin."
+ ${BIN_PATH}/${MOD_NAME} stop
+ echo "Stopping Apache Ranger Admin."
+ ${BIN_PATH}/${MOD_NAME} start
;;
*)
echo "Invalid argument [$1]; Only start|stop|restart are supported."
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/embeddedwebserver/scripts/ranger-admin-services.sh
----------------------------------------------------------------------
diff --git a/embeddedwebserver/scripts/ranger-admin-services.sh b/embeddedwebserver/scripts/ranger-admin-services.sh
new file mode 100755
index 0000000..2a712a7
--- /dev/null
+++ b/embeddedwebserver/scripts/ranger-admin-services.sh
@@ -0,0 +1,79 @@
+#!/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`
+XAPOLICYMGR_DIR=`(cd $realScriptDir/..; pwd)`
+
+XAPOLICYMGR_EWS_DIR=${XAPOLICYMGR_DIR}/ews
+RANGER_JAAS_LIB_DIR="${XAPOLICYMGR_EWS_DIR}/ranger_jaas"
+RANGER_JAAS_CONF_DIR="${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf/ranger_jaas"
+
+JAVA_OPTS=" ${JAVA_OPTS} -XX:MaxPermSize=256m -Xmx1024m -Xms1024m "
+
+if [ -f ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh ]; then
+ . ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh
+fi
+
+for custom_env_script in `find ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/ -name "ranger-admin-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 ${XAPOLICYMGR_EWS_DIR}
+if [ ! -d logs ]
+then
+ mkdir logs
+fi
+
+if [ ${action^^} == "START" ]; then
+ java -Dproc_rangeradmin ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}:${JAVA_HOME}/lib/*" org.apache.ranger.server.tomcat.EmbeddedServer > logs/catalina.out 2>&1 &
+ echo "Apache Ranger Admin has started."
+ exit
+elif [ ${action^^} == "STOP" ]; then
+ java ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}" org.apache.ranger.server.tomcat.StopEmbeddedServer > logs/catalina.out 2>&1
+ echo "Apache Ranger Admin has been stopped."
+ exit
+elif [ ${action^^} == "RESTART" ]; then
+ echo "Restarting Apache Ranger Admin"
+ java ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}" org.apache.ranger.server.tomcat.StopEmbeddedServer > logs/catalina.out 2>&1
+ echo "Apache Ranger Admin has been stopped."
+ echo "Starting Apache Ranger Admin.."
+ java -Dproc_rangeradmin ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}:${JAVA_HOME}/lib/*" org.apache.ranger.server.tomcat.EmbeddedServer > logs/catalina.out 2>&1 &
+ echo "Apache Ranger Admin has started successfully."
+ exit
+elif [ ${action^^} == "VERSION" ]; then
+ cd ${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/lib
+ 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/adbc5e88/embeddedwebserver/scripts/start-ranger-admin.sh
----------------------------------------------------------------------
diff --git a/embeddedwebserver/scripts/start-ranger-admin.sh b/embeddedwebserver/scripts/start-ranger-admin.sh
deleted file mode 100755
index 19df2aa..0000000
--- a/embeddedwebserver/scripts/start-ranger-admin.sh
+++ /dev/null
@@ -1,49 +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.
-
-realScriptPath=`readlink -f $0`
-realScriptDir=`dirname $realScriptPath`
-XAPOLICYMGR_DIR=`(cd $realScriptDir/..; pwd)`
-
-XAPOLICYMGR_EWS_DIR=${XAPOLICYMGR_DIR}/ews
-RANGER_JAAS_LIB_DIR="${XAPOLICYMGR_EWS_DIR}/ranger_jaas"
-RANGER_JAAS_CONF_DIR="${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf/ranger_jaas"
-
-JAVA_OPTS=" ${JAVA_OPTS} -XX:MaxPermSize=256m -Xmx1024m -Xms1024m "
-
-#export JAVA_HOME=
-if [ -f ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh ]; then
- . ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh
-fi
-
-for custom_env_script in `find ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/ -name "ranger-admin-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 ${XAPOLICYMGR_EWS_DIR}
-if [ ! -d logs ]
-then
- mkdir logs
-fi
-java -Dproc_rangeradmin ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}:${JAVA_HOME}/lib/*" org.apache.ranger.server.tomcat.EmbeddedServer > logs/catalina.out 2>&1 &
-echo "Apache Ranger Admin has started"
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/embeddedwebserver/scripts/stop-ranger-admin.sh
----------------------------------------------------------------------
diff --git a/embeddedwebserver/scripts/stop-ranger-admin.sh b/embeddedwebserver/scripts/stop-ranger-admin.sh
deleted file mode 100755
index c6c4bf6..0000000
--- a/embeddedwebserver/scripts/stop-ranger-admin.sh
+++ /dev/null
@@ -1,48 +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.
-
-realScriptPath=`readlink -f $0`
-realScriptDir=`dirname $realScriptPath`
-XAPOLICYMGR_DIR=`(cd $realScriptDir/..; pwd)`
-
-
-XAPOLICYMGR_EWS_DIR=${XAPOLICYMGR_DIR}/ews
-RANGER_JAAS_LIB_DIR="${XAPOLICYMGR_EWS_DIR}/ranger_jaas"
-RANGER_JAAS_CONF_DIR="${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf/ranger_jaas"
-
-#export JAVA_HOME=
-if [ -f ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh ]; then
- . ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh
-fi
-
-for custom_env_script in `find ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/ -name "ranger-admin-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 ${XAPOLICYMGR_EWS_DIR}
-if [ ! -d logs ]
-then
- mkdir logs
-fi
-java ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}" org.apache.ranger.server.tomcat.StopEmbeddedServer > logs/catalina.out 2>&1
-echo "Apache Ranger Admin has been stopped."
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index cba652e..44d8df5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,6 +92,7 @@
<module>ugsync</module>
<module>unixauthclient</module>
<module>unixauthservice</module>
+ <module>ranger-util</module>
</modules>
<properties>
<javac.source.version>1.7</javac.source.version>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/ranger-util/.gitignore
----------------------------------------------------------------------
diff --git a/ranger-util/.gitignore b/ranger-util/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/ranger-util/.gitignore
@@ -0,0 +1 @@
+/target/
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/ranger-util/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-util/pom.xml b/ranger-util/pom.xml
new file mode 100644
index 0000000..047008a
--- /dev/null
+++ b/ranger-util/pom.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger</artifactId>
+ <version>0.4.0</version>
+ </parent>
+ <artifactId>ranger-util</artifactId>
+ <version>0.4.0</version>
+ <name>ranger-util</name>
+ <description>Common Utilities of Ranger</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <version>${hadoop-common.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-2.1</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-api-2.1</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api-2.1</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>tomcat</groupId>
+ <artifactId>jasper-compiler</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>tomcat</groupId>
+ <artifactId>jasper-runtime</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
+ <testSourceDirectory>${project.basedir}/src/test</testSourceDirectory>
+ <scriptSourceDirectory>${project.basedir}/src/scripts</scriptSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-version-annotation</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <target>
+ <exec executable="bash" failonerror="true">
+ <arg value="${project.basedir}/src/scripts/saveVersion.sh" />
+ <arg value="${project.version}" />
+ <arg value="${ranger.version.shortname}" />
+ <arg value="${project.basedir}/src" />
+ </exec>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/gen</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/ranger-util/src/gen/org/apache/ranger/common/package-info.java
----------------------------------------------------------------------
diff --git a/ranger-util/src/gen/org/apache/ranger/common/package-info.java b/ranger-util/src/gen/org/apache/ranger/common/package-info.java
new file mode 100644
index 0000000..5e8bd27
--- /dev/null
+++ b/ranger-util/src/gen/org/apache/ranger/common/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+/*
+ * Generated by saveVersion.sh
+ */
+@RangerVersionAnnotation(version="0.4.0", shortVersion="${ranger.version.shortname}",
+ revision="25517f0b1ff57e2da4a0844f4559390508ecb57e", branch="BUG-210",
+ user="gautam", date="Mon Feb 2 11:40:14 IST 2015", url="git://Gautams-MacBook-Pro.local/Users/gautam/Code/javaWorkspace/XASecure/Repos/incubator-ranger-patch",
+ srcChecksum="b46cebc9c7edc45bd3bcc6193ff245ca")
+package org.apache.ranger.common;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/ranger-util/src/main/java/org/apache/ranger/common/RangerVersionAnnotation.java
----------------------------------------------------------------------
diff --git a/ranger-util/src/main/java/org/apache/ranger/common/RangerVersionAnnotation.java b/ranger-util/src/main/java/org/apache/ranger/common/RangerVersionAnnotation.java
new file mode 100644
index 0000000..e1346a1
--- /dev/null
+++ b/ranger-util/src/main/java/org/apache/ranger/common/RangerVersionAnnotation.java
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+
+package org.apache.ranger.common;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.hadoop.classification.InterfaceStability;
+/**
+ * RangerVersionAnnotation.
+ *
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PACKAGE)
+@InterfaceStability.Unstable
+public @interface RangerVersionAnnotation {
+
+ /**
+ * Get the Ranger version
+ * @return the version string "0.6.3-dev"
+ */
+ String version();
+
+ /**
+ * Get the Ranger short version containing major/minor/change version numbers
+ * @return the short version string "0.6.3"
+ */
+ String shortVersion();
+
+ /**
+ * Get the username that compiled Ranger.
+ */
+ String user();
+
+ /**
+ * Get the date when Ranger was compiled.
+ * @return the date in unix 'date' format
+ */
+ String date();
+
+ /**
+ * Get the url for the subversion repository.
+ */
+ String url();
+
+ /**
+ * Get the subversion revision.
+ * @return the revision number as a string (eg. "451451")
+ */
+ String revision();
+
+ /**
+ * Get the branch from which this was compiled.
+ * @return The branch name, e.g. "trunk" or "branches/branch-0.20"
+ */
+ String branch();
+
+ /**
+ * Get a checksum of the source files from which
+ * Ranger was compiled.
+ * @return a string that uniquely identifies the source
+ **/
+ String srcChecksum();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/ranger-util/src/main/java/org/apache/ranger/common/RangerVersionInfo.java
----------------------------------------------------------------------
diff --git a/ranger-util/src/main/java/org/apache/ranger/common/RangerVersionInfo.java b/ranger-util/src/main/java/org/apache/ranger/common/RangerVersionInfo.java
new file mode 100644
index 0000000..2cd9d3c
--- /dev/null
+++ b/ranger-util/src/main/java/org/apache/ranger/common/RangerVersionInfo.java
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+package org.apache.ranger.common;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+/**
+ * RangerVersionInfo.
+ *
+ */
+@InterfaceAudience.Private
+@InterfaceStability.Unstable
+public class RangerVersionInfo {
+
+ private static Package myPackage;
+ private static RangerVersionAnnotation version;
+
+ static {
+ myPackage = RangerVersionAnnotation.class.getPackage();
+ version = myPackage.getAnnotation(RangerVersionAnnotation.class);
+ }
+
+ /**
+ * Get the meta-data for the Ranger package.
+ *
+ * @return
+ */
+ static Package getPackage() {
+ return myPackage;
+ }
+
+ /**
+ * Get the Ranger version.
+ *
+ * @return the Ranger version string, eg. "0.6.3-dev"
+ */
+ public static String getVersion() {
+ return version != null ? version.version() : "Unknown";
+ }
+
+ /**
+ * Get the Ranger short version, with major/minor/change version numbers.
+ *
+ * @return short version string, eg. "0.6.3"
+ */
+ public static String getShortVersion() {
+ return version != null ? version.shortVersion() : "Unknown";
+ }
+
+ /**
+ * Get the subversion revision number for the root directory
+ *
+ * @return the revision number, eg. "451451"
+ */
+ public static String getRevision() {
+ return version != null ? version.revision() : "Unknown";
+ }
+
+ /**
+ * Get the branch on which this originated.
+ *
+ * @return The branch name, e.g. "trunk" or "branches/branch-0.20"
+ */
+ public static String getBranch() {
+ return version != null ? version.branch() : "Unknown";
+ }
+
+ /**
+ * The date that Ranger was compiled.
+ *
+ * @return the compilation date in unix date format
+ */
+ public static String getDate() {
+ return version != null ? version.date() : "Unknown";
+ }
+
+ /**
+ * The user that compiled Ranger.
+ *
+ * @return the username of the user
+ */
+ public static String getUser() {
+ return version != null ? version.user() : "Unknown";
+ }
+
+ /**
+ * Get the subversion URL for the root Ranger directory.
+ */
+ public static String getUrl() {
+ return version != null ? version.url() : "Unknown";
+ }
+
+ /**
+ * Get the checksum of the source files from which Ranger was built.
+ **/
+ public static String getSrcChecksum() {
+ return version != null ? version.srcChecksum() : "Unknown";
+ }
+
+ /**
+ * Returns the buildVersion which includes version, revision, user and date.
+ */
+ public static String getBuildVersion() {
+ return RangerVersionInfo.getVersion() + " from "
+ + RangerVersionInfo.getRevision() + " by "
+ + RangerVersionInfo.getUser() + " source checksum "
+ + RangerVersionInfo.getSrcChecksum();
+ }
+
+ public static void main(String[] args) {
+ System.out.println("");
+ System.out.println("Ranger " + getVersion());
+ System.out.println("Subversion " + getUrl() + " -r " + getRevision());
+ System.out.println("Compiled by " + getUser() + " on " + getDate());
+ System.out.println("From source with checksum " + getSrcChecksum());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/ranger-util/src/scripts/saveVersion.sh
----------------------------------------------------------------------
diff --git a/ranger-util/src/scripts/saveVersion.sh b/ranger-util/src/scripts/saveVersion.sh
new file mode 100755
index 0000000..33c8820
--- /dev/null
+++ b/ranger-util/src/scripts/saveVersion.sh
@@ -0,0 +1,109 @@
+#!/usr/bin/env 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.
+
+
+# This file is used to generate the package-info.java class that
+# records the version, revision, branch, user, timestamp, and url
+unset LANG
+unset LC_CTYPE
+unset LC_TIME
+version=$1
+shortversion=$2
+src_dir=$3
+revision=$4
+branch=$5
+url=$6
+user=`whoami`
+date=`date`
+dir=`pwd`
+cwd=`dirname $dir`
+if [ "$revision" = "" ]; then
+ if git rev-parse HEAD 2>/dev/null > /dev/null ; then
+ revision=`git log -1 --pretty=format:"%H"`
+ hostname=`hostname`
+ branch=`git branch | sed -n -e 's/^* //p'`
+ url="git://${hostname}${cwd}"
+ elif [ -d .svn ]; then
+ revision=`svn info ../ | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
+ url=`svn info ../ | sed -n -e 's/^URL: \(.*\)/\1/p'`
+ # Get canonical branch (branches/X, tags/X, or trunk)
+ branch=`echo $url | sed -n -e 's,.*\(branches/.*\)$,\1,p' \
+ -e 's,.*\(tags/.*\)$,\1,p' \
+ -e 's,.*trunk$,trunk,p'`
+ else
+ revision="Unknown"
+ branch="Unknown"
+ url="file://$cwd"
+ fi
+fi
+if [ "$branch" = "" ]; then
+ branch="Unknown"
+fi
+if [ "$url" = "" ]; then
+ url="file://$cwd"
+fi
+
+if [ -x /sbin/md5 ]; then
+ md5="/sbin/md5"
+else
+ md5="md5sum"
+fi
+
+srcChecksum=`find ../ -name '*.java' | grep -v generated-sources | LC_ALL=C sort | xargs $md5 | $md5 | cut -d ' ' -f 1`
+
+mkdir -p $src_dir/gen/org/apache/ranger/common
+
+# In Windows, all the following string ends with \r, need to get rid of them
+branch=`echo $branch | tr -d '\r'`
+user=`echo $user | tr -d '\r'`
+date=`echo $date | tr -d '\r'`
+url=`echo $url | tr -d '\r'`
+srcChecksum=`echo $srcChecksum | tr -d '\r'`
+
+cat << EOF | \
+ sed -e "s/VERSION/$version/" -e "s/SHORTVERSION/$shortversion/" \
+ -e "s/USER/$user/" -e "s/DATE/$date/" \
+ -e "s|URL|$url|" -e "s/REV/$revision/" \
+ -e "s|BRANCH|$branch|" -e "s/SRCCHECKSUM/$srcChecksum/" \
+ > $src_dir/gen/org/apache/ranger/common/package-info.java
+/*
+ * 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.
+ */
+
+/*
+ * Generated by saveVersion.sh
+ */
+@RangerVersionAnnotation(version="VERSION", shortVersion="SHORTVERSION",
+ revision="REV", branch="BRANCH",
+ user="USER", date="DATE", url="URL",
+ srcChecksum="SRCCHECKSUM")
+package org.apache.ranger.common;
+EOF
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/security-admin/pom.xml
----------------------------------------------------------------------
diff --git a/security-admin/pom.xml b/security-admin/pom.xml
index 32d15d3..1149ee6 100644
--- a/security-admin/pom.xml
+++ b/security-admin/pom.xml
@@ -346,6 +346,11 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop-common.version}</version>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/security-admin/scripts/setup.sh
----------------------------------------------------------------------
diff --git a/security-admin/scripts/setup.sh b/security-admin/scripts/setup.sh
index bc241e2..e9b69a6 100755
--- a/security-admin/scripts/setup.sh
+++ b/security-admin/scripts/setup.sh
@@ -1215,7 +1215,6 @@ setup_install_files(){
fi
fi
-
if [ ! -d ${XAPOLICYMGR_DIR}/ews/logs ]; then
log "[I] ${XAPOLICYMGR_DIR}/ews/logs folder"
mkdir -p ${XAPOLICYMGR_DIR}/ews/logs
@@ -1231,6 +1230,10 @@ setup_install_files(){
chown -R ${unix_user}:${unix_group} ${INSTALL_DIR}/*
fi
fi
+
+ # Copy ranger-admin-services to /usr/bin
+ ln -sf ${INSTALL_DIR}/ews/ranger-admin-services.sh /usr/bin/ranger-admin
+ chmod ug+rx /usr/bin/ranger-admin
}
execute_java_patches(){
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/src/main/assembly/usersync.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/usersync.xml b/src/main/assembly/usersync.xml
index 0adb0a3..23ff7ec 100644
--- a/src/main/assembly/usersync.xml
+++ b/src/main/assembly/usersync.xml
@@ -48,6 +48,7 @@
<include>org.apache.hadoop:hadoop-common</include>
<include>org.apache.commons:commons-csv</include>
<include>org.apache.ranger:credentialbuilder</include>
+ <include>org.apache.ranger:ranger-util</include>
</includes>
<unpack>false</unpack>
</dependencySet>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/ugsync/pom.xml
----------------------------------------------------------------------
diff --git a/ugsync/pom.xml b/ugsync/pom.xml
index 93b812e..a7d01ff 100644
--- a/ugsync/pom.xml
+++ b/ugsync/pom.xml
@@ -94,11 +94,17 @@
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.ranger</groupId>
+ <dependency>
+ <groupId>org.apache.ranger</groupId>
<artifactId>credentialbuilder</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/unixauthservice/scripts/initd
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/initd b/unixauthservice/scripts/initd
index e429cce..0ff6da4 100644
--- a/unixauthservice/scripts/initd
+++ b/unixauthservice/scripts/initd
@@ -23,17 +23,23 @@
# Short-Description: Start/Stop Ranger Usersync
### END INIT INFO
-START_SCRIPT=/usr/bin/ranger-usersync-start
-STOP_SCRIPT=/usr/bin/ranger-usersync-stop
+BIN_PATH=/usr/bin
+MOD_NAME=ranger-usersync
case $1 in
start)
- ${START_SCRIPT}
+ ${BIN_PATH}/${MOD_NAME} start
;;
stop)
- ${STOP_SCRIPT}
+ ${BIN_PATH}/${MOD_NAME} stop
+ ;;
+ restart)
+ echo "Stopping Apache Ranger Usersync."
+ ${BIN_PATH}/${MOD_NAME} stop
+ echo "Starting Apache Ranger Usersync."
+ ${BIN_PATH}/${MOD_NAME} start
;;
*)
- echo "Invalid argument [$1]; Only start|stop are supported."
+ echo "Invalid argument [$1]; Only start | stop | restart, are supported."
exit 1
esac
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/unixauthservice/scripts/ranger-usersync-services.sh
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/ranger-usersync-services.sh b/unixauthservice/scripts/ranger-usersync-services.sh
new file mode 100644
index 0000000..27978d3
--- /dev/null
+++ b/unixauthservice/scripts/ranger-usersync-services.sh
@@ -0,0 +1,111 @@
+#!/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`
+cd $realScriptDir
+cdir=`pwd`
+
+pidf=${cdir}/.mypid
+
+
+if [ ${action^^} == "START" ]; then
+
+ #Export JAVA_HOME
+ . ${cdir}/conf/java_home.sh
+
+ for custom_env_script in `find ${cdir}/conf/ -name "ranger-usersync-env*"`; do
+ if [ -f $custom_env_script ]; then
+ . $custom_env_script
+ fi
+ done
+
+ if [ "$JAVA_HOME" != "" ]; then
+ export PATH=$JAVA_HOME/bin:$PATH
+ fi
+
+ logdir=`grep -P '^[ \t]*logdir[ \t]*=' ${cdir}/install.properties | awk -F= '{ print $2 }' | tr '\t' ' ' | sed -e 's:[ ]::g'`
+ if [ ! -d ${logdir} ]
+ then
+ logdir=/var/log/ranger-usersync
+ fi
+ cp="${cdir}/dist/*:${cdir}/lib/*:${cdir}/conf"
+ [ ! -d ${logdir} ] && mkdir -p ${logdir}
+ ${cdir}/ranger-usersync-services.sh stop
+ cd ${cdir}
+ umask 0077
+ nohup java -Dproc_rangerusersync ${JAVA_OPTS} -Dlogdir="${logdir}" -cp "${cp}" org.apache.ranger.authentication.UnixAuthenticationService -enableUnixAuth > ${logdir}/auth.log 2>&1 &
+ echo $! > ${pidf}
+ sleep 5
+ port=`grep '^[ ]*authServicePort' ${cdir}/conf/unixauthservice.properties | awk -F= '{ print $2 }' | awk '{ print $1 }'`
+ pid=`netstat -antp | grep LISTEN | grep ${port} | awk '{ print $NF }' | awk -F/ '{ if ($2 == "java") { print $1 } }'`
+ if [ "${pid}" != "" ]
+ then
+ echo "UnixAuthenticationService has started successfully."
+ else
+ echo "UnixAuthenticationService failed to start. Please refer to log files under ${logdir} for further details."
+ fi
+ exit;
+
+elif [ ${action^^} == "STOP" ]; then
+ port=`grep '^[ ]*authServicePort' ${cdir}/conf/unixauthservice.properties | awk -F= '{ print $2 }' | awk '{ print $1 }'`
+ pid=`netstat -antp | grep LISTEN | grep ${port} | awk '{ print $NF }' | awk -F/ '{ if ($2 == "java") { print $1 } }'`
+ if [ "${pid}" != "" ]
+ then
+ kill -9 ${pid}
+ echo "AuthenticationService [pid = ${pid}] has been stopped."
+ fi
+ if [ -f ${pidf} ]
+ then
+ npid=`cat ${pidf}`
+ if [ "${npid}" != "" ]
+ then
+ if [ "${pid}" != "${npid}" ]
+ then
+ if [ -a /proc/${npid} ]
+ then
+ echo "AuthenticationService [pid = ${npid}] has been stopped."
+ kill -9 ${npid} > /dev/null 2>&1
+ echo > ${pidf}
+ fi
+ fi
+ fi
+ fi
+ exit;
+
+elif [ ${action^^} == "RESTART" ]; then
+ echo "Stopping Apache Ranger Usersync"
+ ${cdir}/ranger-usersync-services.sh stop
+ echo "Starting Apache Ranger Usersync"
+ ${cdir}/ranger-usersync-services.sh start
+ exit;
+elif [ ${action^^} == "VERSION" ]; then
+ cd ${cdir}/lib
+ 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/adbc5e88/unixauthservice/scripts/setup.sh
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/setup.sh b/unixauthservice/scripts/setup.sh
index 5afb199..473d8a6 100755
--- a/unixauthservice/scripts/setup.sh
+++ b/unixauthservice/scripts/setup.sh
@@ -368,5 +368,9 @@ then
fi
+# Create SoftLink of ranger-usersync-services to /usr/bin/
+ln -sf ${INSTALL_DIR}/ranger-usersync-services.sh /usr/bin/${MOD_NAME}
+chmod ug+rx /usr/bin/${MOD_NAME}
+
# Start the service
#service ${MOD_NAME} start
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/unixauthservice/scripts/start.sh
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/start.sh b/unixauthservice/scripts/start.sh
deleted file mode 100755
index 399e6b2..0000000
--- a/unixauthservice/scripts/start.sh
+++ /dev/null
@@ -1,61 +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.
-
-
-realScriptPath=`readlink -f $0`
-realScriptDir=`dirname $realScriptPath`
-cd $realScriptDir
-cdir=`pwd`
-
-echo "Starting UnixAuthenticationService"
-#export JAVA_HOME=
-. ${cdir}/conf/java_home.sh
-
-for custom_env_script in `find ${cdir}/conf/ -name "ranger-usersync-env*"`; do
- if [ -f $custom_env_script ]; then
- . $custom_env_script
- fi
-done
-
-if [ "$JAVA_HOME" != "" ]; then
- export PATH=$JAVA_HOME/bin:$PATH
-fi
-
-pidf=${cdir}/.mypid
-
-#logdir=`grep '^[ \t]*logdir[ \t]*=' ${cdir}/install.properties | awk -F= '{ print $2 }' | sed -e 's:[ \t]*::g'`
-logdir=`grep -P '^[ \t]*logdir[ \t]*=' ${cdir}/install.properties | awk -F= '{ print $2 }' | tr '\t' ' ' | sed -e 's:[ ]::g'`
-if [ ! -d ${logdir} ]
-then
- logdir=/var/log/ranger-usersync
-fi
-cp="${cdir}/dist/*:${cdir}/lib/*:${cdir}/conf"
-[ ! -d ${logdir} ] && mkdir -p ${logdir}
-${cdir}/stop.sh
-cd ${cdir}
-umask 0077
-nohup java -Dproc_rangerusersync ${JAVA_OPTS} -Dlogdir="${logdir}" -cp "${cp}" org.apache.ranger.authentication.UnixAuthenticationService -enableUnixAuth > ${logdir}/auth.log 2>&1 &
-echo $! > ${pidf}
-sleep 5
-port=`grep '^[ ]*authServicePort' ${cdir}/conf/unixauthservice.properties | awk -F= '{ print $2 }' | awk '{ print $1 }'`
-pid=`netstat -antp | grep LISTEN | grep ${port} | awk '{ print $NF }' | awk -F/ '{ if ($2 == "java") { print $1 } }'`
-if [ "${pid}" != "" ]
-then
- echo "UnixAuthenticationService has started successfully."
-else
- echo "UnixAuthenticationService failed to start. Please refer to log files under ${logdir} for further details."
-fi
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/adbc5e88/unixauthservice/scripts/stop.sh
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/stop.sh b/unixauthservice/scripts/stop.sh
deleted file mode 100755
index 1933364..0000000
--- a/unixauthservice/scripts/stop.sh
+++ /dev/null
@@ -1,46 +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.
-
-realScriptPath=`readlink -f $0`
-realScriptDir=`dirname $realScriptPath`
-cd $realScriptDir
-cdir=`pwd`
-
-pidf=${cdir}/.mypid
-port=`grep '^[ ]*authServicePort' ${cdir}/conf/unixauthservice.properties | awk -F= '{ print $2 }' | awk '{ print $1 }'`
-pid=`netstat -antp | grep LISTEN | grep ${port} | awk '{ print $NF }' | awk -F/ '{ if ($2 == "java") { print $1 } }'`
-if [ "${pid}" != "" ]
-then
- kill -9 ${pid}
- echo "AuthenticationService [pid = ${pid}] has been stopped."
-fi
-if [ -f ${pidf} ]
-then
- npid=`cat ${pidf}`
- if [ "${npid}" != "" ]
- then
- if [ "${pid}" != "${npid}" ]
- then
- if [ -a /proc/${npid} ]
- then
- echo "AuthenticationService [pid = ${npid}] has been stopped."
- kill -9 ${npid} > /dev/null 2>&1
- echo > ${pidf}
- fi
- fi
- fi
-fi
\ No newline at end of file