#!/usr/bin/env bash FROM_DIR='/home/chensenlai/buyao/buyao-server/buyao-parent' TO_USER='buyao' TO_HOST='47.112.248.215' TO_DIR='/srv/server/buyao-parent' echo " 1) cd ${FROM_DIR}" cd ${FROM_DIR} echo " 2) build project buyao-$1..." mvn clean mvn package -Dmaven.test.skip=true -Pprod -pl buyao-$1 -am jar_package=`find ${FROM_DIR}/buyao-$1/target -name "*.jar"` echo " 3) scp ${jar_package} ${TO_USER}@${TO_HOST}:${TO_DIR}/buyao-$1/buyao-$1.jar.swp" scp ${jar_package} ${TO_USER}@${TO_HOST}:${TO_DIR}/buyao-$1/buyao-$1.jar.swp echo " 4) ${TO_USER}@${TO_HOST} ${TO_DIR}/run.sh restart..." ssh -l ${TO_USER} ${TO_HOST} "cd ${TO_DIR}/buyao-$1; mv buyao-$1.jar.swp buyao-$1.jar; sh run.sh restart;" echo done! exit 0