deploy-prod-02.sh 771 B

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