/bin/sh: Backup Wordpress to Gmail

The code below was written pretty quickly. It backs up the Wordpress directory, the mySQL table, zips it then emails it to the specified gmail account. Mutt must be installed.. change the variables to suit your environment.

 1#!/bin/sh
 2theDate=`/bin/date +%Y%m%d`
 3
 4######### backup DB ##########
 5/usr/local/bin/mysqldump -A -u root --password=myPass > /tmp/mysql-${theDate}
 6cd /tmp
 7tar -czf mysql-${theDate}.tgz mysql-${theDate}
 8
 9######### backup wordpress dir containing all blogs ##########
10cd /www
11tar -czf wordpress-${theDate}.tgz wordpress
12mv wordpress-${theDate}.tgz /tmp/
13
14######### send mail (10MB limit so send individual emails) ##########
15######### (also throws in a copy of httpd.conf for good measure) ##########
16
17mutt -s "mySQL backups (${theDate})" -a /tmp/mysql-${theDate}.tgz [email protected] > /dev/null
18mutt -s "wordpress backups (${theDate})" -a /tmp/wordpress-${theDate}.tgz -a /usr/local/etc/apache/httpd.conf [email protected] > /dev/null
19
20######### cleanup ##########
21
22rm /tmp/mysql-${theDate}
23rm /tmp/mysql-${theDate}.tgz
24rm /tmp/wordpress-${theDate}.tgz