Created
March 20, 2014 14:00
-
-
Save renekreijveld/9664367 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# jrestore - Restore a local site backup | |
# | |
# Copyright 2014 Rene Kreijveld - [email protected] | |
# | |
# This program is free software; you may redistribute it and/or modify it. | |
# General variables | |
VERSION=1.0 | |
STOREPATH=/backups/sites | |
# Determine path of script | |
MYPATH=$( cd $(dirname $0) ; pwd -P ) | |
# Include general functions | |
. ${MYPATH}/joomlafunctions | |
echo -e "\njrestore verion ${VERSION}, written by René Kreijveld\n" | |
echo "This is a Joomla! $versr.$versd site. Starting backup restore." | |
echo -e "The following backups were found (most recent backup is listed first):\n" | |
ls -1t ${STOREPATH}/${sitename}.* | |
echo -e "\nRestore which backup (copy/paste filename), or press Ctrl-C to abort?\n" | |
read -p "Filename: " restorefile | |
echo -e "\nUnpacking backup $restorefile" | |
tar xzf $restorefile | |
echo "Restoring database backup $database.sql" | |
if mysql --host=$host --user=$dbuser --password=$password --socket=$MYSOCK $database < $database.sql | |
then | |
echo "Database backup $database.sql restored." | |
rm $database.sql | |
echo -e "\nRestore backup website $sitenameclean completed." | |
exit 0 | |
else | |
echo "Error restoring Database backup $database.sql!" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment