-
-
Save ted-wq-x/46df16350f204f15a76873df72d61422 to your computer and use it in GitHub Desktop.
常用shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
CMD=java | |
JAVA_VER=$(java -version 2>&1 | grep -i version | sed 's/.*version ".*\.\(.*\)\..*"/\1/; 1q') | |
if [ ${JAVA_VER} -lt 8 ]; then | |
echo "JDK版本过低,请使用1.8及以上版本" | |
exit 1 | |
fi | |
#使用cp覆盖-classpath的jar,linux使用:,windows使用; | |
SEPARATOR=";" | |
if [ "$(uname)" == "Darwin" ]; then | |
# Do something under Mac OS X platform | |
SEPARATOR=":" | |
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then | |
# Do something under GNU/Linux platform | |
SEPARATOR=":" | |
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then | |
# Do something under 32 bits Windows NT platform | |
SEPARATOR=";" | |
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then | |
# Do something under 64 bits Windows NT platform | |
SEPARATOR=";" | |
fi | |
MAIN_CLASS=com.fiberhome.gather.ApplicationMain | |
CP_PATH="../plugin/*$SEPARATOR../lib/*" | |
CONFIG="-Dspring.config.location=../config/ -Dlogging.config=../config/log4j2.xml" | |
DEBUG="" | |
if [ "$1" == "debug" ]; then | |
DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=8889" | |
shift | |
fi | |
#$@传递命令行参数 | |
${CMD} -cp ${CP_PATH} ${DEBUG} ${CONFIG} ${MAIN_CLASS} "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment