stopNetworkServer 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #!/bin/sh
  2. # Licensed to the Apache Software Foundation (ASF) under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. # Unless required by applicable law or agreed to in writing,
  11. # software distributed under the License is distributed on an
  12. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. # KIND, either express or implied. See the License for the
  14. # specific language governing permissions and limitations
  15. # under the License.
  16. if [ -n "$derby_common_debug" ] ; then
  17. set -x
  18. fi
  19. # OS specific support. $var _must_ be set to either true or false.
  20. cygwin=false;
  21. darwin=false;
  22. case "`uname`" in
  23. CYGWIN*) cygwin=true ;;
  24. Darwin*) darwin=true
  25. if [ -z "$JAVA_HOME" ] ; then
  26. JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
  27. fi
  28. ;;
  29. esac
  30. if [ -z "$DERBY_HOME" -o ! -d "$DERBY_HOME" ] ; then
  31. ## resolve links - $0 may be a link to derby's home
  32. PRG="$0"
  33. progname=`basename "$0"`
  34. # need this for relative symlinks
  35. while [ -h "$PRG" ] ; do
  36. ls=`ls -ld "$PRG"`
  37. link=`expr "$ls" : '.*-> \(.*\)$'`
  38. if expr "$link" : '/.*' > /dev/null; then
  39. PRG="$link"
  40. else
  41. PRG=`dirname "$PRG"`"/$link"
  42. fi
  43. done
  44. DERBY_HOME=`dirname "$PRG"`/..
  45. # make it fully qualified
  46. DERBY_HOME=`cd "$DERBY_HOME" && pwd`
  47. fi
  48. # For Cygwin, ensure paths are in UNIX format before anything is touched
  49. if $cygwin ; then
  50. [ -n "$DERBY_HOME" ] &&
  51. DERBY_HOME=`cygpath --unix "$DERBY_HOME"`
  52. [ -n "$JAVA_HOME" ] &&
  53. JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  54. fi
  55. # set DERBY_LIB location
  56. DERBY_LIB="${DERBY_HOME}/lib"
  57. if [ -z "$JAVACMD" ] ; then
  58. if [ -n "$JAVA_HOME" ] ; then
  59. if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
  60. # IBM's JDK on AIX uses strange locations for the executables
  61. JAVACMD="$JAVA_HOME/jre/sh/java"
  62. else
  63. JAVACMD="$JAVA_HOME/bin/java"
  64. fi
  65. else
  66. JAVACMD=`which java 2> /dev/null `
  67. if [ -z "$JAVACMD" ] ; then
  68. JAVACMD=java
  69. fi
  70. fi
  71. fi
  72. if [ ! -x "$JAVACMD" ] ; then
  73. echo "Error: JAVA_HOME is not defined correctly."
  74. echo " We cannot execute $JAVACMD"
  75. exit 1
  76. fi
  77. # set local classpath, don't overwrite the user's
  78. LOCALCLASSPATH=$DERBY_LIB/derby.jar:$DERBY_LIB/derbynet.jar:$DERBY_LIB/derbytools.jar:$DERBY_LIB/derbyoptionaltools.jar:$DERBY_LIB/derbyclient.jar
  79. # if CLASSPATH_OVERRIDE env var is set, LOCALCLASSPATH will be
  80. # user CLASSPATH first and derby-found jars after.
  81. # In that case, the user CLASSPATH will override derby-found jars
  82. #
  83. # if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour
  84. # with derby-found jars first and user CLASSPATH after
  85. if [ -n "$CLASSPATH" ] ; then
  86. # merge local and specified classpath
  87. if [ -z "$LOCALCLASSPATH" ] ; then
  88. LOCALCLASSPATH="$CLASSPATH"
  89. elif [ -n "$CLASSPATH_OVERRIDE" ] ; then
  90. LOCALCLASSPATH="$CLASSPATH:$LOCALCLASSPATH"
  91. else
  92. LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH"
  93. fi
  94. # remove class path from launcher -cp option
  95. CLASSPATH=""
  96. fi
  97. # For Cygwin, switch paths to appropriate format before running java
  98. # For PATHs convert to unix format first, then to windows format to ensure
  99. # both formats are supported. Probably this will fail on directories with ;
  100. # in the name in the path. Let's assume that paths containing ; are more
  101. # rare than windows style paths on cygwin.
  102. if $cygwin; then
  103. if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
  104. format=mixed
  105. else
  106. format=windows
  107. fi
  108. DERBY_HOME=`cygpath --$format "$DERBY_HOME"`
  109. DERBY_LIB=`cygpath --$format "$DERBY_LIB"`
  110. if [ -n "$JAVA_HOME" ]; then
  111. JAVA_HOME=`cygpath --$format "$JAVA_HOME"`
  112. fi
  113. LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"`
  114. LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"`
  115. if [ -n "$CLASSPATH" ] ; then
  116. CP_TEMP=`cygpath --path --unix "$CLASSPATH"`
  117. CLASSPATH=`cygpath --path --$format "$CP_TEMP"`
  118. fi
  119. CYGHOME=`cygpath --$format "$HOME"`
  120. fi
  121. # add a second backslash to variables terminated by a backslash under cygwin
  122. if $cygwin; then
  123. case "$DERBY_HOME" in
  124. *\\ )
  125. DERBY_HOME="$DERBY_HOME\\"
  126. ;;
  127. esac
  128. case "$CYGHOME" in
  129. *\\ )
  130. CYGHOME="$CYGHOME\\"
  131. ;;
  132. esac
  133. case "$LOCALCLASSPATH" in
  134. *\\ )
  135. LOCALCLASSPATH="$LOCALCLASSPATH\\"
  136. ;;
  137. esac
  138. case "$CLASSPATH" in
  139. *\\ )
  140. CLASSPATH="$CLASSPATH\\"
  141. ;;
  142. esac
  143. fi
  144. # Readjust classpath for MKS
  145. # expr match
  146. if [ \( "`expr $SHELL : '.*sh.exe$'`" -gt 0 \) -a \( "$cygwin" = "false" \) ]; then
  147. LOCALCLASSPATH=`echo $LOCALCLASSPATH | sed -E 's/([\d\w]*):([\d\w]*)/\1;\2/g
  148. '`
  149. fi
  150. #!/bin/sh
  151. # Licensed to the Apache Software Foundation (ASF) under one
  152. # or more contributor license agreements. See the NOTICE file
  153. # distributed with this work for additional information
  154. # regarding copyright ownership. The ASF licenses this file
  155. # to you under the Apache License, Version 2.0 (the
  156. # "License"); you may not use this file except in compliance
  157. # with the License. You may obtain a copy of the License at
  158. # http://www.apache.org/licenses/LICENSE-2.0
  159. # Unless required by applicable law or agreed to in writing,
  160. # software distributed under the License is distributed on an
  161. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  162. # KIND, either express or implied. See the License for the
  163. # specific language governing permissions and limitations
  164. # under the License.
  165. derby_exec_command="exec \"$JAVACMD\" $DERBY_OPTS -classpath \"$LOCALCLASSPATH\" org.apache.derby.drda.NetworkServerControl shutdown $@"
  166. eval $derby_exec_command