build.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ############
  2. # autdop 编译,部署脚本
  3. ############
  4. #!/bin/sh
  5. set -e
  6. ENV=$1
  7. # 时间戳
  8. TIMESTAMP=`date '+%Y-%m-%d_%H-%M-%S'`
  9. if [ -z ${ENV} ]; then
  10. echo 'error: sh build.sh ENV'
  11. exit -1
  12. fi
  13. DST_DIR='/home/reghao/tmp/autodop'
  14. if [ -d ${DST_DIR}/app ]; then
  15. rm -rf ${DST_DIR}/app/*
  16. rm -rf ${DST_DIR}/app.*
  17. else
  18. mkdir -p ${DST_DIR}/app
  19. fi
  20. # 编译打包应用
  21. SRC_DIR='/home/reghao/code/aha/autodop'
  22. cd ${SRC_DIR}
  23. mvn clean package -P${ENV}
  24. cp dmaster/target/dmaster-1.0.0.jar ${DST_DIR}/app/dmaster-1.0.0_${TIMESTAMP}.jar
  25. cp dagent/target/dagent-1.0.0.jar ${DST_DIR}/app/dagent-1.0.0_${TIMESTAMP}.jar
  26. cp scripts/run-jar.sh ${DST_DIR}/app/run-jar.sh
  27. mvn clean
  28. # 拷贝应用到远程主机
  29. cd scripts
  30. #sh ./copy_to_remote.sh dmaster ${TIMESTAMP} 192.168.0.50 gjs
  31. sh ./copy_to_remote.sh dagent ${TIMESTAMP} 192.168.0.171 gjs
  32. sh ./copy_to_remote.sh dagent ${TIMESTAMP} 192.168.0.172 guanjingsong
  33. sh ./copy_to_remote.sh dagent ${TIMESTAMP} 192.168.0.173 guanjingsong
  34. sh ./copy_to_remote.sh dagent ${TIMESTAMP} 192.168.0.174 guanjingsong
  35. #sh ./copy_to_remote.sh dagent ${TIMESTAMP} 192.168.0.126 gjs
  36. #sh ./copy_to_remote.sh dagent ${TIMESTAMP} s61.iquizoo.com xcJ50y0BNpa1H1Qj
  37. #sh ./copy_to_remote.sh dagent ${TIMESTAMP} s71.iquizoo.com fbxK4ZxCSlczNvECRaf65Nv5nBDnfZ
  38. #sh ./copy_to_remote.sh dagent ${TIMESTAMP} s72.iquizoo.com D34VqpmIdk5wynUSECGp0QC7iEUoWo
  39. #sh ./copy_to_remote.sh dagent ${TIMESTAMP} s73.iquizoo.com CYsZufT56vX6rr6FLD6IF1YCXiJbwv
  40. #sh ./copy_to_remote.sh dagent ${TIMESTAMP} s74.iquizoo.com YcxtZI6yQeeSDw0mDD7eeunwOEhAca