You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by am...@apache.org on 2023/04/26 09:10:32 UTC

[knox] branch master updated: KNOX-2903 - Add restart command to gateway.sh (#751)

This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new ead942b83 KNOX-2903 - Add restart command to gateway.sh (#751)
ead942b83 is described below

commit ead942b837b92d0369400b6e36c55fd31e657dfc
Author: Attila Magyar <m....@gmail.com>
AuthorDate: Wed Apr 26 11:10:25 2023 +0200

    KNOX-2903 - Add restart command to gateway.sh (#751)
---
 gateway-release/home/bin/gateway.sh | 72 ++++++++++++++++++++-----------------
 1 file changed, 39 insertions(+), 33 deletions(-)

diff --git a/gateway-release/home/bin/gateway.sh b/gateway-release/home/bin/gateway.sh
index 320fa84b9..ba0ec178b 100755
--- a/gateway-release/home/bin/gateway.sh
+++ b/gateway-release/home/bin/gateway.sh
@@ -68,6 +68,40 @@ export APP_ERR_FILE="$APP_LOG_DIR/$APP_NAME.err"
 DEFAULT_APP_RUNNING_IN_FOREGROUND="$GATEWAY_SERVER_RUN_IN_FOREGROUND"
 export APP_RUNNING_IN_FOREGROUND=${KNOX_GATEWAY_RUNNING_IN_FOREGROUND:-$DEFAULT_APP_RUNNING_IN_FOREGROUND}
 
+function startGateway() {
+  printEnv=0
+  while [[ $# -gt 0 ]]
+  do
+    key="$1"
+    case $key in
+      --printEnv)
+       printEnv=1
+       shift # past argument
+       ;;
+      --test-gateway-retry-attempts)
+       export APP_STATUS_TEST_RETRY_ATTEMPTS="$2"
+       shift # past argument
+       shift # past value
+       ;;
+      --test-gateway-retry-sleep)
+       export APP_STATUS_TEST_RETRY_SLEEP="$2"
+       shift # past argument
+       shift # past value
+       ;;
+      *)    # unknown option
+       shift # past argument
+       ;;
+    esac
+  done
+  if [ $printEnv -eq 1 ]; then
+    printEnv
+  fi
+  checkEnv
+  export TEST_APP_STATUS=true
+  # shellcheck disable=SC2119
+  appStart
+}
+
 function main {
    checkJava
 
@@ -76,43 +110,15 @@ function main {
          setupEnv
          ;;
       start)
-         printEnv=0
-         while [[ $# -gt 0 ]]
-         do
-           key="$1"
-
-           case $key in
-             --printEnv)
-               printEnv=1
-               shift # past argument
-               ;;
-             --test-gateway-retry-attempts)
-               export APP_STATUS_TEST_RETRY_ATTEMPTS="$2"
-               shift # past argument
-               shift # past value
-               ;;
-             --test-gateway-retry-sleep)
-               export APP_STATUS_TEST_RETRY_SLEEP="$2"
-               shift # past argument
-               shift # past value
-               ;;
-             *)    # unknown option
-               shift # past argument
-               ;;
-           esac
-         done
-
-         if [ $printEnv -eq 1 ]; then
-           printEnv
-         fi
-         checkEnv
-         export TEST_APP_STATUS=true
-         # shellcheck disable=SC2119
-         appStart
+         startGateway "$@"
          ;;
       stop)   
          appStop
          ;;
+      restart)
+         appStop
+         startGateway "$@"
+         ;;
       status)
          appStatus
          ;;