Guest User

Untitled

a guest
Jul 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -e
  4.  
  5. APPROOT=/var/www/answerhub
  6. BKPSUF=$(date +%Y-%m-%d:%H:%M)
  7. PERM="tomcat:tomcat"
  8. STOPCMD="systemctl stop tomcat"
  9. STARTCMD="systemctl restart tomcat"
  10.  
  11. NEXTREL="$1"
  12.  
  13. [ -d "$NEXTREL" -a -d "$NEXTREL/teamhub.war" -a -d "$NEXTREL/teamhub.home" ] || {
  14. echo "Usage: $0 <new release folder>" >&2
  15. exit 0
  16. }
  17.  
  18. # In most cases, upgrading your AnswerHub installation is relatively easy.
  19. # Simply follow the steps below and after restarting your application server,
  20. # AnswerHub will run any additional upgrade tasks that are required and then
  21. # your new version will be ready to run.
  22.  
  23. # 1. Stop your running application server
  24. echo $STOPCMD
  25. $STOPCMD
  26.  
  27. # 2. Make a backup of your existing teamhub.war and teamhub.home folders
  28. THUBWAR=$APPROOT/teamhub.war
  29. [ -d "$THUBWAR" ] && {
  30. echo mv $THUBWAR{,-$BKPSUF}
  31. mv $THUBWAR{,-$BKPSUF}
  32. }
  33.  
  34. THUBHOME=$APPROOT/teamhub.home
  35. [ -d "$THUBHOME" ] && {
  36. echo mv $THUBHOME{,-$BKPSUF}
  37. mv $THUBHOME{,-$BKPSUF}
  38. }
  39.  
  40. # Replace your existing teamhub.war folder with the teamhub.war from the new release
  41. echo cp -a $NEXTREL/teamhub.war $APPROOT/
  42. cp -a $NEXTREL/teamhub.war $APPROOT/
  43.  
  44. # Migrate your teamhub.war/WEB-INF/classes/META-INF/config.properties to the new
  45. # directory
  46. echo cat $THUBWAR-$BKPSUF/WEB-INF/classes/META-INF/config.properties > $THUBWAR/WEB-INF/classes/META-INF/config.properties
  47. cat $THUBWAR-$BKPSUF/WEB-INF/classes/META-INF/config.properties > $THUBWAR/WEB-INF/classes/META-INF/config.properties
  48.  
  49. # Replace your existing teamhub.home folder with the teamhub.home from the new
  50. # release
  51. echo cp -a $NEXTREL/teamhub.home $APPROOT/
  52. cp -a $NEXTREL/teamhub.home $APPROOT/
  53.  
  54. # Copy any custom themes and plugins to the teamhub.home/themes folder and the
  55. # teamhub.home/plugins/installed folder.
  56. [ -d themes ] && {
  57. echo mkdir -p $THUBHOME/themes/
  58. mkdir -p $THUBHOME/themes/
  59. echo rsync -rcav themes/ $THUBHOME/themes/
  60. rsync -rcav themes/ $THUBHOME/themes/
  61. }
  62.  
  63. [ -d plugins/installed ] && {
  64. echo mkdir -p $THUBHOME/plugins/installed
  65. mkdir -p $THUBHOME/plugins/installed
  66. echo rsync -rcav plugins/ $THUBHOME/plugins/
  67. rsync -rcav plugins/ $THUBHOME/plugins/
  68. }
  69.  
  70. # Copy any files from your old teamhub.home/sites folder to the new
  71. # teamhub.home/sites folder.
  72. [ -d $THUBHOME/sites ] && {
  73. echo rm -rf $THUBHOME/sites
  74. rm -rf $THUBHOME/sites
  75. echo mkdir -p $THUBHOME/sites
  76. mkdir -p $THUBHOME/sites
  77. }
  78. echo rsync -rcav $THUBHOME-$BKPSUF/sites/ $THUBHOME/sites/
  79. rsync -rcav $THUBHOME-$BKPSUF/sites/ $THUBHOME/sites/
  80.  
  81. # Finally, verify that the folders in the new teamhub.home are owned by the user
  82. # running your application server.
  83. echo chown -R $PERM $APPROOT/
  84. chown -R $PERM $APPROOT/
  85.  
  86. # After these steps, restart your application server and the new AnswerHub should
  87. # load. If your new version does not start, please double-check that you followed
  88. # all the steps outlined above and then contact your support representative for
  89. # help with the upgrade.
  90. echo $STARTCMD
  91. $STARTCMD
Add Comment
Please, Sign In to add comment