Uploaded image for project: 'Apache Knox'
  1. Apache Knox
  2. KNOX-1833

Knox gateway couldn't come up when ran on Korn Shell

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0, 1.3.0
    • Fix Version/s: None
    • Component/s: KnoxShell
    • Labels:
      None
    • Environment:
      Knox
      Korn Shell

      Description

      APP_BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

      When the script is running in Korn shell, ${BASH_SOURCE[0]} is always empty and this is because ${BASH_SOURCE[0]} is valid only for Bash shell. Thus, the path is not constructed correctly. Later on when we have any other installation scripts running, it is unable to find gateway.sh since the Bash Source is not inclusive of Korn shell path to the gateway.sh.  

      However we did find a work around for it. A simple script has to be added into the gateway.sh script. It basically checks for two kinds of shells: either Bash or Korn and then adds the path according to whatever the type is. Here's what the code snippet looks like: 

       

      if [ $SHELL == '/bin/bash' ] || [ $SHELL == '/bin/sh' ] 
      then 
        THIS_SCRIPT=${BASH_SOURCE[0]} 
        echo $THIS_SCRIPT 
      elif [ $SHELL == '/bin/ksh' ] 
      then 
        THIS_SCRIPT=${.sh.file} 
        echo $THIS_SCRIPT 
      else echo NO MATCH. 
      fi 
      APP_BIN_DIR="$( cd "$( dirname ${THIS_SCRIPT} )" && pwd )"
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sash2727 Sarah S
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: