Review Board 1.7.22


Sqoop2: sqoop.sh execution error

Review Request #10689 - Created April 21, 2013 and updated

Vasanth kumar RJ
SQOOP-1003
Reviewers
Sqoop
sqoop-sqoop2
Problem while starting and stopping sqoop server.
Patch supports softlink for both server and client command. 
Done

Diff revision 2 (Latest)

1 2
1 2

  1. dist/src/main/bin/sqoop.sh: Loading...
dist/src/main/bin/sqoop.sh
Revision a218441 New Change
[20] 27 lines
[+20]
28
  print_usage
28
  print_usage
29
  exit
29
  exit
30
fi
30
fi
31

    
   
31

   
32
OLD_DIR=`pwd`
32
OLD_DIR=`pwd`
33
CUR_DIR=`cd $(dirname $(which $0))/..; pwd`

   
34
cd ${CUR_DIR}

   
35
echo "Sqoop home directory: ${CUR_DIR}..."

   
36

    
   
33

   
Moved from 62

    
   
34
# resolve links - $0 may be a softlink
Moved from 63

    
   
35
PRG="${0}"

    
   
36

   
Moved from 65

    
   
37
while [ -h "${PRG}" ]; do
Moved from 66

    
   
38
  ls=`ls -ld "${PRG}"`
Moved from 67

    
   
39
  link=`expr "$ls" : '.*-> \(.*\)$'`
Moved from 68

    
   
40
  if expr "$link" : '/.*' > /dev/null; then
Moved from 69

    
   
41
    PRG="$link"
Moved from 70

    
   
42
  else
Moved from 71

    
   
43
    PRG=`dirname "${PRG}"`/"$link"
Moved from 72

    
   
44
  fi
Moved from 73

    
   
45
done

    
   
46

   
Moved from 75

    
   
47
BASEDIR=`dirname ${PRG}`
Moved from 76

    
   
48
BASEDIR=`cd ${BASEDIR}/..;pwd`

    
   
49

   

    
   
50
cd ${BASEDIR}

    
   
51
echo "Sqoop home directory: ${BASEDIR}"

    
   
52

   
37
CATALINA_BIN=${CATALINA_BIN:-server/bin}
53
CATALINA_BIN=${CATALINA_BIN:-server/bin}
38
CLIENT_LIB=${CLIENT_LIB:-client/lib}
54
CLIENT_LIB=${CLIENT_LIB:-client/lib}
39

    
   
55

   
40
setup_catalina_opts() {
56
setup_catalina_opts() {
41
  # The Java System properties 'sqoop.http.port' and 'sqoop.admin.port' are
57
  # The Java System properties 'sqoop.http.port' and 'sqoop.admin.port' are
[+20] [20] 15 lines
[+20]
57
      echo "Usage: sqoop.sh server <start/stop>"
73
      echo "Usage: sqoop.sh server <start/stop>"
58
      exit
74
      exit
59
    fi
75
    fi
60
    actionCmd=$2
76
    actionCmd=$2
61

    
   
77

   
62
    # resolve links - $0 may be a softlink
Moved to 34

   
63
    PRG="${0}"
Moved to 35

   
64

    
   

   
65
    while [ -h "${PRG}" ]; do
Moved to 37

   
66
      ls=`ls -ld "${PRG}"`
Moved to 38

   
67
      link=`expr "$ls" : '.*-> \(.*\)$'`
Moved to 39

   
68
      if expr "$link" : '/.*' > /dev/null; then
Moved to 40

   
69
        PRG="$link"
Moved to 41

   
70
      else
Moved to 42

   
71
        PRG=`dirname "${PRG}"`/"$link"
Moved to 43

   
72
      fi
Moved to 44

   
73
    done
Moved to 45

   
74

    
   

   
75
    BASEDIR=`dirname ${PRG}`
Moved to 47

   
76
    BASEDIR=`cd ${BASEDIR}/..;pwd`
Moved to 48

   
77

    
   

   
78
    source ${BASEDIR}/bin/sqoop-sys.sh
78
    source ${BASEDIR}/bin/sqoop-sys.sh
79
    setup_catalina_opts
79
    setup_catalina_opts
80

    
   
80

   
81
    # There seems to be a bug in catalina.sh whereby catalina.sh doesn't respect
81
    # There seems to be a bug in catalina.sh whereby catalina.sh doesn't respect
82
    # CATALINA_OPTS when stopping the tomcat server. Consequently, we have to hack around
82
    # CATALINA_OPTS when stopping the tomcat server. Consequently, we have to hack around
[+20] [20] 11 lines
[+20]
94
    ;;
94
    ;;
95

    
   
95

   
96
  client)
96
  client)
97
    # Build class path with full path to each library
97
    # Build class path with full path to each library
98
    for f in $CLIENT_LIB/*.jar; do
98
    for f in $CLIENT_LIB/*.jar; do
99
      CLASSPATH="${CLASSPATH}:$CUR_DIR/$f"
99
      CLASSPATH="${CLASSPATH}:${BASEDIR}/$f"
100
    done
100
    done
101

    
   
101

   
102
    # We need to change current directory back to original as optional user side script
102
    # We need to change current directory back to original as optional user side script
103
    # might be specified with relative path.
103
    # might be specified with relative path.
104
    cd ${OLD_DIR}
104
    cd ${OLD_DIR}
[+20] [20] 9 lines
  1. dist/src/main/bin/sqoop.sh: Loading...