packDfs.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #! /bin/sh
  2. ### ### ### ##
  3. ## ## # # #
  4. ### ## # #
  5. # # # # ## ### # ## ### ####
  6. # # # # # # ## # # # # #
  7. # # # # ### # # ##### # #
  8. # # # # # ## ## # # #
  9. ### ### ### # # #### ####
  10. clear
  11. host="47.92.151.165"
  12. port="8080"
  13. company="wecise"
  14. auth="wecise.admin:admin1234)(*&"
  15. ctime=`date +%Y%m%d`_`date +%H%M%S`
  16. target="./m3web/${host}_${company}/${ctime}"
  17. dfs=("/app/assets" "/app/matrix/m3appstore" "/app/matrix/m3auditlog" "/app/matrix/m3config" "/assets/images" "/etc" "/home/admin" "/opt" "/script/matrix")
  18. echo
  19. echo 'M³web 应用打包**********************************************************************'
  20. echo
  21. echo '打包服务器:'${host}':'${port}
  22. echo
  23. echo '打包租户:'${company}
  24. echo
  25. mkdir -p ${target}
  26. echo '存放目录:'$target
  27. echo
  28. echo "Web前端打包开始。。。"
  29. echo
  30. #ssh matrix@"${host}" "cd /opt/matrix/web;tar czvf - --exclude=/opt/matrix/web/public/web/vendor-20200726 --exclude=.DS_Store --exclude=/opt/matrix/web/templates/matrix/test public/ templates/ " > "${target}/web.tar.gz"
  31. s/ro action=remote host="${host}" username="matrix" password="MndzWDFxYVo=" cmds='"cd /opt/matrix/web;tar czvf - --exclude=/opt/matrix/web/public/web/vendor-20200726 --exclude=.DS_Store --exclude=/opt/matrix/web/templates/matrix/test public/ templates/ " > "'${target}'/web.tar.gz"'
  32. echo
  33. echo "文件系统打包开始。。。"
  34. echo
  35. for v in ${dfs[@]}
  36. do
  37. name="dfs${v//\//_}"
  38. echo "${v}"
  39. echo
  40. curl -u "${auth}" --location --request POST "http://${host}:${port}/fs/export?issys=true&srcpath=${v}" >> "${target}/${name}.zip"
  41. echo
  42. echo
  43. done
  44. echo "合并文件系统"
  45. echo
  46. cd $target
  47. for x in dfs_*.zip
  48. do
  49. unzip -d dfs -o -u $x
  50. done
  51. zip -r dfs.zip dfs
  52. echo "删除中件文件"
  53. echo
  54. rm -rf ./dfs_*.zip
  55. rm -rf dfs
  56. echo
  57. ls -rtl
  58. echo '应用打包完成**********************************************************************'