Last active
August 29, 2015 14:21
-
-
Save doostinharrell/5a64478aea82580e36df to your computer and use it in GitHub Desktop.
archive.sh - Archive Drupal website for Pantheon.io Deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Read Me: To run this command type: sh archive.sh sitename | |
# | |
# Author: Dustin Harrell (The Wired Mouse) | |
# Version: 1.0.dev | |
# Description: Running this script will create archived zip files for deployment on Pantheon.io | |
# | |
if [ -e $1 ]; | |
then | |
echo "ERROR: please supply site name ie: thewiredmouse --- sh archive.sh thewiredmouse" | |
exit 1 | |
fi | |
# Currently this script will only archive Drupal 6 and 7 websites | |
# | |
#if [ -e $2 ]; | |
# then | |
# echo "ERROR: please supply a cms ie: drupal, wordpress --- sh archive.sh thewiredmouse drupal" | |
# exit 1 | |
#fi | |
sudo echo "Archiving Website" | |
SCRIPTDIR="/home/drush-docs/twm" | |
VHDIR="/home/$1" | |
ARCHIVE="archive-$(date +%F--%I-%M-%S)" | |
PWD=$(pwd) | |
cd $VHDIR | |
mkdir $ARCHIVE | |
cp -Rf public_html/ $ARCHIVE/code/ | |
cd $ARCHIVE/code/ | |
mv sites/default/files/ ../ | |
drush sql-dump > database.sql | |
mv database.sql ../ | |
cd .. | |
tar -zcf code.tar.gz code/ | |
rm -Rf code/ | |
tar -zcf files.tar.gz files/ | |
rm -Rf files/ | |
tar -zcf database.tar.gz database.sql | |
rm -Rf database.sql | |
sudo echo "Archive Complete" | |
sudo echo $PWD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment