12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #!/bash/sh
- TARGET_MODULE=""
- if [ "$1" == "appservice" ]
- then
- TARGET_MODULE="xchat-web-api"
- elif [ "$1" == "record" ]
- then
- TARGET_MODULE="xchat-web-record"
- elif [ "$1" == "task" ]
- then
- TARGET_MODULE="xchat-web-task"
- fi
- TARGET_USER="root"
- TARGET_IP="120.78.13.246"
- TARGET_FROM_BASE="/home/chensenlai/shanp/project/chat-server/apiservice/"
- TARGET_FROM="${TARGET_MODULE}/target/$1.jar"
- TARGET_TO_BASE="/srv/server/chat-server/$1/"
- TARGET_TO="$1.jar"
- TARGET_TO_SWAP="${TARGET_TO}.swap"
- if [ -z TARGET_MODULE ]
- then
- echo -e "\033[35merror: unkonw target. [appservice|record|task]\033[0m"
- exit -1
- fi
- echo "cd into ${TARGET_FROM_BASE}${TARGET_FROM}"
- cd ${TARGET_FROM_BASE}
- #echo -e "\033[35m 0) switch branch ... \033[0m"
- #git checkout dev
- #echo -e "\033[35m 1) git pull ... \033[0m"
- #git pull
- echo " 2) build project $1..."
- mvn clean
- mvn install -Pprod -pl ${TARGET_MODULE} -am
- echo " 3) scp to ${TARGET_USER}@${TARGET_IP}:${TARGET_TO_BASE}${TARGET_TO_SWAP}"
- scp ${TARGET_FROM_BASE}${TARGET_FROM} ${TARGET_USER}@${TARGET_IP}:${TARGET_TO_BASE}${TARGET_TO_SWAP}
- echo " 4) ${TARGET_USER}@${TARGET_IP} ${TARGET_TO_BASE}run.sh restart..."
- ssh -l ${TARGET_USER} ${TARGET_IP} "cd ${TARGET_TO_BASE};
- mv ${TARGET_TO_SWAP} ${TARGET_TO};
- sh run.sh restart"
- echo done!
- exit 0
|