totvs.zsh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #
  2. # Just some utilities for use in ecm development.
  3. #
  4. setopt rmstarsilent
  5. HOME="/home/carlos"
  6. ECM_WS="$HOME/totvs/ws"
  7. ECM_JBOSS="$HOME/Public/ecm/JBoss-7.1.1"
  8. ECM_PORT="8080"
  9. VOLDEMORT=$ECM_WS/voldemort
  10. ECM=$ECM_WS/ecm
  11. INSTALLER="n"
  12. DRY_CLEAN="n"
  13. # fuckin aliases
  14. alias ecmu=ecmup
  15. alias ecmb=ecmbuild
  16. alias ecmc=ecmclean
  17. alias ecms=ecmstart
  18. alias ecmo=ecmstop
  19. alias ecmi=ecminstall
  20. alias ecmri=ecmruninstall
  21. alias ecm=ecmfull
  22. # update ecm
  23. ecmup() {
  24. echo "update all the things!"
  25. cd $VOLDEMORT && svn up
  26. cd $ECM && svn up
  27. }
  28. # build it!
  29. ecmbuild() {
  30. echo "build? no problem sir..."
  31. cd $VOLDEMORT && mvncie && \
  32. cd $VOLDEMORT/social-ecm && \
  33. cd $VOLDEMORT/wcm && mvncie && \
  34. cd $ECM/wecmpackage && mvncie && \
  35. cd $VOLDEMORT/ecm && mvncie && \
  36. ecminstall
  37. }
  38. # gen installer or cp wars...
  39. ecminstall() {
  40. case $@ in
  41. -*i*)
  42. INSTALLER=y
  43. ;;
  44. esac
  45. if [[ "$INSTALLER" == "y" ]]; then
  46. echo "generating installer..."
  47. cd $VOLDEMORT/ecm/installer
  48. mvnci -am -Drun=installer -DLinux64=true -DappServer=jboss
  49. else
  50. echo "cpying wars..."
  51. cd $VOLDEMORT/ecm/build && mvnci && \
  52. cd $VOLDEMORT/wcm/build && mvnci && \
  53. cd $VOLDEMORT/social-ecm/build && mvnci
  54. fi
  55. }
  56. # clean jboss trash folders
  57. ecmclean() {
  58. echo "cleaning jboss shit"
  59. case $@ in
  60. -*d*)
  61. DRY_CLEAN="y"
  62. ;;
  63. esac
  64. if [[ "$DRY_CLEAN" == "y" ]]; then
  65. rm -rf $ECM_JBOSS/standalone/deployments/*.{failed,deployed,dodeploy,deploying}
  66. else
  67. rm -rf $ECM_JBOSS/standalone/deployments/*
  68. fi
  69. rm -rf $ECM_JBOSS/standalone/{log,tmp,data}
  70. rm -rf $ECM_JBOSS/solr/zoo_data
  71. }
  72. # start jboss server
  73. ecmstart() {
  74. # why shall I start server if i just gen a installer?
  75. if [[ "$INSTALLER" == "y" ]]; then
  76. ecmruninstall
  77. else
  78. echo "starting jboss"
  79. cd $ECM_JBOSS/bin
  80. JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DzkRun -Dbootstrap_conf=true" ./standalone.sh
  81. fi
  82. }
  83. ecmruninstall() {
  84. echo "ok, lets install this crap :)"
  85. cd $VOLDEMORT/ecm/installer/izpack/target
  86. if [[ -f ECM-Linux64.zip ]]; then
  87. mkdir -p /tmp/ecmi
  88. rm -rf /tmp/ecmi/*
  89. unzip ECM-Linux64 -d /tmp/ecmi/
  90. cd /tmp/ecmi/
  91. chmod a+x ECM-Installer-64.sh
  92. ./ECM-Installer-64.sh
  93. else
  94. echo "uhoh, installer doesnt exist ($VOLDEMORT/ecm/installer/izpack/target/ECM-Linux64.zip)"
  95. fi
  96. }
  97. # stop jboss (usually on 8080)
  98. ecmstop() {
  99. echo "kill jboss (or whatever you are running on 8080"
  100. fuser -k $ECM_PORT/tcp
  101. }
  102. # do all the things
  103. ecmfull() {
  104. echo "serious business here. let's have a coffee.."
  105. ecmstop
  106. ecmclean
  107. ecmup
  108. ecmbuild && ecmstart
  109. }