#WordPress core Backup Script
# Copyright (c) 2005 Podz http://www.tamba2.org.uk
#
# v3
#
# v3: date / blog name added to download
# v2: corrected whatever was wrong with v1
# v1: arrival.
#
# Credits for assistance to:
# Justin - http://www.wantmoore.com
# Kyle - http://www.kylev.com
# Westi - http://www.ftwr.co.uk/blog
#
#More information is at http://www.tamba2.org.uk/wordpress/cron
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#Set the 4 variables
#Replace what is AFTER the = with the information from your wp-config.php file
#That's your information on the right okay ?

DBNAME=DB_NAME

DBPASS=DB_PASSWORD

DBUSER=DB_USER

#Keep the " around your address
EMAIL="you@your_email.com"

#Change the 'wp_' to match your table_prefix in the database
mysqldump --opt -u $DBUSER -p$DBPASS $DBNAME > backup.sql
gzip backup.sql
DATE=`date +%Y%m%d` ; mv backup.sql.gz $DBNAME-backup-$DATE.sql.gz
echo 'Blog Name: Your mySQL Backup is attached' | mutt -a $DBNAME-backup-$DATE.sql.gz $EMAIL -s "MySQL Backup"
rm $DBNAME-backup-$DATE.sql.gz
