Created
July 3, 2014 11:22
-
-
Save renekreijveld/4cbeae83c68711ca35b3 to your computer and use it in GitHub Desktop.
Create a full backup of a Joomla website to tar gzip file and store in backup directory
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 | |
# jbackupstore -- Create a full backup of a Joomla website to tar gzip file and store in backup directory | |
# | |
# Copyright 2012 Rene Kreijveld - [email protected] | |
# | |
# This program is free software; you may redistribute it and/or modify it. | |
# | |
# Warning! This script needs the file joomlafunctions. This has to be installed in the same directory as this script. | |
# | |
# Define general variables | |
NOW=$(date +"%Y%m%d-%H%M%S") | |
STOREPATH=/backups/sites | |
LOGFILE=/usr/local/sbin/sitesbackup.log | |
# Determine path of script | |
MYPATH=$( cd $(dirname $0) ; pwd -P ) | |
# Include general functions | |
. ${MYPATH}/joomlafunctions | |
echo "`date` Start backup $sitename" >> ${LOGFILE} | |
# dump the database to a .sql file | |
mysqldump --skip-opt --add-drop-table --add-locks --create-options --disable-keys --lock-tables --quick --set-charset --host=$host --user=$dbuser --password=$password --socket=$MYSOCK $database > $database.sql | |
# backup site | |
tar czf ${STOREPATH}/${sitename}.${NOW}.tgz .htaccess * | |
# cleanup datebase dump | |
rm $database.sql | |
echo "`date` End backup $sitename" >> ${LOGFILE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment