Guest User

Untitled

a guest
Jan 19th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. WHITE='\033[1;37m'
  4. NC='\033[0m'
  5.  
  6. #Space Separated List of Databases to Dump
  7. DATABASES="xwiki_itdept xwiki_mainwiki"
  8. DBUSER=xwiki
  9. DBPASS=secret
  10.  
  11. # SLES 11 is located /srv/tomcat6/webapps
  12. WEBAPPDIR=/opt/bitnami/apache-tomcat/webapps/
  13. #What context (dir) does your application deploy to
  14. DEPLOYCONTEXT=ROOT
  15.  
  16.  
  17. ###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. DEPLOYDIR=${WEBAPPDIR}/${DEPLOYCONTEXT}
  19. DATE=xwiki-full-backup-$(date '+%Y-%m-%d_%H%M%S')
  20. mkdir ./${DATE}
  21.  
  22. #backup mysql
  23. echo "Backing up Mysql"
  24. for DATABASE in $DATABASES
  25. do
  26. echo -e "backing up the ${WHITE}$DATABASE${NC} database"
  27. /opt/bitnami/mysql/bin/mysqldump -h 127.0.0.1 -u ${DBUSER} --password=${DBPASS} --max_allowed_packet=512m --add-drop-database --databases ${DATABASE} | /bin/gzip > ./${DATE}/${DATABASE}.sql.gz
  28. done
  29.  
  30. echo "Backing up xwiki configuration"
  31. /bin/cp ${DEPLOYDIR}/WEB-INF/hibernate.cfg.xml ./${DATE}/hibernate.cfg.xml
  32. /bin/cp ${DEPLOYDIR}/WEB-INF/xwiki.cfg ./${DATE}/xwiki.cfg
  33. /bin/cp ${DEPLOYDIR}/WEB-INF/xwiki.properties ./${DATE}/xwiki.properties
  34.  
  35. #Backup Deploy Context
  36. echo "Backing UP deploy Context"
  37. /bin/tar -C ${DEPLOYDIR}/../ -zcf ./${DATE}/ROOT.tar.gz ROOT
  38.  
  39. echo -e "${WHITE}DONE!${NC}"
Add Comment
Please, Sign In to add comment