knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From su...@apache.org
Subject knox git commit: KNOX-864 Making gateway and ldap scripts upstart compatible (Attila Kanto via Sumit Gupta)
Date Thu, 02 Feb 2017 21:01:45 GMT
Repository: knox
Updated Branches:
  refs/heads/master dccdedda4 -> 0b161c91f


KNOX-864 Making gateway and ldap scripts upstart compatible (Attila Kanto via Sumit Gupta)


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/0b161c91
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/0b161c91
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/0b161c91

Branch: refs/heads/master
Commit: 0b161c91ffa6323672b27537c74f3cded626e4a3
Parents: dccdedd
Author: Sumit Gupta <sumit@apache.org>
Authored: Thu Feb 2 15:54:25 2017 -0500
Committer: Sumit Gupta <sumit@apache.org>
Committed: Thu Feb 2 15:57:58 2017 -0500

----------------------------------------------------------------------
 gateway-release/home/bin/gateway.sh | 44 +++++++++++++++++---------------
 gateway-release/home/bin/ldap.sh    | 44 +++++++++++++++++---------------
 2 files changed, 48 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/0b161c91/gateway-release/home/bin/gateway.sh
----------------------------------------------------------------------
diff --git a/gateway-release/home/bin/gateway.sh b/gateway-release/home/bin/gateway.sh
index 79fe10f..02c0b15 100755
--- a/gateway-release/home/bin/gateway.sh
+++ b/gateway-release/home/bin/gateway.sh
@@ -108,32 +108,36 @@ function setupEnv {
 function appStart {
    checkEnv
 
-   getPID
-   if [ "$?" -eq "0" ]; then
-     printf "$APP_LABEL is already running with PID $APP_PID.\n"
-     exit 0
-   fi
+   if [ "$GATEWAY_SERVER_RUN_IN_FOREGROUND" == true ]; then
+      $JAVA $APP_MEM_OPTS $APP_DBG_OPTS $APP_LOG_OPTS -jar $APP_JAR >>$APP_OUT_FILE
2>>$APP_ERR_FILE
+   else
+      getPID
+      if [ "$?" -eq "0" ]; then
+         printf "$APP_LABEL is already running with PID $APP_PID.\n"
+         exit 0
+      fi
   
-   printf "Starting $APP_LABEL "
+      printf "Starting $APP_LABEL "
    
-   rm -f $APP_PID_FILE
+      rm -f $APP_PID_FILE
 
-   nohup $JAVA $APP_MEM_OPTS $APP_DBG_OPTS $APP_LOG_OPTS -jar $APP_JAR >>$APP_OUT_FILE
2>>$APP_ERR_FILE & printf $!>$APP_PID_FILE || exit 1
+      nohup $JAVA $APP_MEM_OPTS $APP_DBG_OPTS $APP_LOG_OPTS -jar $APP_JAR >>$APP_OUT_FILE
2>>$APP_ERR_FILE & printf $!>$APP_PID_FILE || exit 1
 
-   getPID
-   for ((i=0; i<APP_START_WAIT_TIME*10; i++)); do
+      getPID
+      for ((i=0; i<APP_START_WAIT_TIME*10; i++)); do
+         appIsRunning $APP_PID
+         if [ "$?" -eq "0" ]; then break; fi
+         sleep 0.1
+      done
       appIsRunning $APP_PID
-      if [ "$?" -eq "0" ]; then break; fi
-      sleep 0.1
-   done
-   appIsRunning $APP_PID
-   if [ "$?" -ne "1" ]; then
-      printf "failed.\n"
-      rm -f $APP_PID_FILE
-      exit 1
+      if [ "$?" -ne "1" ]; then
+         printf "failed.\n"
+         rm -f $APP_PID_FILE
+         exit 1
+      fi
+      printf "succeeded with PID $APP_PID.\n"
+      return 0
    fi
-   printf "succeeded with PID $APP_PID.\n"
-   return 0
 }
 
 function appStop {

http://git-wip-us.apache.org/repos/asf/knox/blob/0b161c91/gateway-release/home/bin/ldap.sh
----------------------------------------------------------------------
diff --git a/gateway-release/home/bin/ldap.sh b/gateway-release/home/bin/ldap.sh
index c9b2c0b..7c88957 100755
--- a/gateway-release/home/bin/ldap.sh
+++ b/gateway-release/home/bin/ldap.sh
@@ -96,32 +96,36 @@ function main {
 function appStart {
    createLogFiles
 
-   getPID
-   if [ $? -eq 0 ]; then
-     printf "$APP_LABEL is already running with PID $APP_PID.\n"
-     exit 0
-   fi
+   if [ "$LDAP_SERVER_RUN_IN_FOREGROUND" == true ]; then
+      $JAVA $APP_MEM_OPTS $APP_DBG_OPTS $APP_LOG_OPTS -jar $APP_JAR $APP_CONF_DIR >>$APP_OUT_FILE
2>>$APP_ERR_FILE
+   else
+      getPID
+      if [ $? -eq 0 ]; then
+         printf "$APP_LABEL is already running with PID $APP_PID.\n"
+         exit 0
+      fi
   
-   printf "Starting $APP_LABEL "
+      printf "Starting $APP_LABEL "
    
-   rm -f $APP_PID_FILE
+      rm -f $APP_PID_FILE
 
-   nohup $JAVA $APP_MEM_OPTS $APP_DBG_OPTS $APP_LOG_OPTS -jar $APP_JAR $APP_CONF_DIR >>$APP_OUT_FILE
2>>$APP_ERR_FILE & printf $!>$APP_PID_FILE || exit 1
+      nohup $JAVA $APP_MEM_OPTS $APP_DBG_OPTS $APP_LOG_OPTS -jar $APP_JAR $APP_CONF_DIR >>$APP_OUT_FILE
2>>$APP_ERR_FILE & printf $!>$APP_PID_FILE || exit 1
 
-   getPID
-   for ((i=0; i<APP_START_WAIT_TIME*10; i++)); do
+      getPID
+      for ((i=0; i<APP_START_WAIT_TIME*10; i++)); do
+         appIsRunning $APP_PID
+         if [ $? -eq 0 ]; then break; fi
+         sleep 0.1
+      done
       appIsRunning $APP_PID
-      if [ $? -eq 0 ]; then break; fi
-      sleep 0.1
-   done
-   appIsRunning $APP_PID
-   if [ $? -ne 1 ]; then
-      printf "failed.\n"
-      rm -f $APP_PID_FILE
-      exit 1
+      if [ $? -ne 1 ]; then
+         printf "failed.\n"
+         rm -f $APP_PID_FILE
+         exit 1
+      fi
+      printf "succeeded with PID $APP_PID.\n"
+      return 0
    fi
-   printf "succeeded with PID $APP_PID.\n"
-   return 0
 }
 
 function appStop {


Mime
View raw message