Browse Source

add typo3 clone-install-on-test.sh

Olivier Massot 2 years ago
parent
commit
a94a23a979
1 changed files with 26 additions and 0 deletions
  1. 26 0
      typo3/clone-install-on-test.sh

+ 26 - 0
typo3/clone-install-on-test.sh

@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# This script will compress and download the typo3 installation directory from prod-front, and extract and install it on the test host
+# <!> this does not clone the database, use clonedb if needed
+host=$(hostname)
+if [[ $host =~ test-v?[0-9]* ]]
+then
+  echo "Current testing env : $host"
+else
+  echo "Invalid host : $host ; this script is designed to run on testing env only"
+  exit 1
+fi
+
+now=$(date '+%Y%m%d-%H%M')
+
+# shellcheck disable=SC2029
+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
+scp exploitation@prod-front:/var/www/typo3/typo3_install_$now.tar.gz /home/exploitation || exit
+
+rm -r /var/www/typo3 || exit
+mkdir /var/www/typo3
+
+tar xvzf "/home/exploitation/typo3_install_$now.tar.gz" -C /var/www/typo3/ || exit
+rm "/home/exploitation/typo3_install_$now.tar.gz"
+
+echo "+ Typo3 install cloned +"