clone-install-on-test.sh 1.1 KB

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. # This script will compress and download the typo3 installation directory from prod-front, and extract and install it on the test host
  3. # <!> this does not clone the database, use clonedb if needed
  4. # <!> This may need sudo rights to run correctly
  5. host=$(hostname)
  6. if [[ $host =~ test-v?[0-9]* ]]
  7. then
  8. echo "Current testing env : $host"
  9. else
  10. echo "Invalid host : $host ; this script is designed to run on testing env only"
  11. exit 1
  12. fi
  13. now=$(date '+%Y%m%d-%H%M')
  14. # shellcheck disable=SC2029
  15. ssh exploitation@prod-front "cd /var/www/typo3/ ; tar cvzf /home/exploitation/typo3_install_$now.tar.gz . --exclude=./public/fileadmin/user_upload/* --exclude=./archive --exclude=./public/fileadmin/_processed_ --exclude=./var/log/* --exclude=./var/cache/*" || exit
  16. scp exploitation@prod-front:/home/exploitation/typo3_install_$now.tar.gz /home/exploitation || exit
  17. rm -rf /var/www/typo3 || exit
  18. mkdir /var/www/typo3
  19. tar xvzf "/home/exploitation/typo3_install_$now.tar.gz" -C /var/www/typo3/ || exit
  20. rm "/home/exploitation/typo3_install_$now.tar.gz"
  21. ssh exploitation@prod-front "rm /home/exploitation/typo3_install_$now.tar.gz"
  22. echo "+ Typo3 install cloned +"