You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/08/10 01:50:07 UTC

[GitHub] [shardingsphere] TeslaCN commented on a diff in pull request #20038: Enhance startup script

TeslaCN commented on code in PR #20038:
URL: https://github.com/apache/shardingsphere/pull/20038#discussion_r941936986


##########
shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/bin/start.sh:
##########
@@ -137,12 +156,57 @@ if [ -z "$PORT" ]; then
 fi
 
 CLASS_PATH=${CONF_PATH}:${CLASS_PATH}
-MAIN_CLASS=${MAIN_CLASS}" "${PORT}" "${CONF_PATH}" "${ADDRESSES}
+MAIN_CLASS="${MAIN_CLASS} ${PORT} ${CONF_PATH} ${ADDRESSES}"
+
+if [ $PORT = -1 ]; then
+  REAL_PORT=3307
+else
+  REAL_PORT=$PORT
+fi
 
-echo "Starting the $SERVER_NAME ..."
 echo "The classpath is ${CLASS_PATH}"
 echo "main class ${MAIN_CLASS}"
-
-nohup java ${JAVA_OPTS} ${JAVA_MEM_OPTS} -classpath ${CLASS_PATH} ${MAIN_CLASS} >> ${STDOUT_FILE} 2>&1 &
-sleep 1
-echo "Please check the STDOUT file: $STDOUT_FILE"
+echo "STDOUT log file: $STDOUT_FILE"
+echo -e "Starting the $SERVER_NAME ...\c"
+
+for((i=1;i<=10;i++)); do
+  if [ "$i" = "10" ]; then
+    echo "failed: Address already in use"
+    exit
+  fi
+
+  PORT_STATUS=$(netstat -ant |$GREP $REAL_PORT |$GREP LISTEN)

Review Comment:
   ShardingSphere-Proxy could listen on specified address such as `192.168.0.1/red`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org