Hacks and Hints TechieVarta

Icon

Another Techie Varta

Backing up Wordpress MU Site

Several of us don’t have need for and enthu for an elaborated backup system. Here is a small script that will backups the WPMU site including database and the file system and e-mails it to provided e-mail address. For small site this works perfectly. You can also use it to e-mail the backups to Gmail or msn mail. For automatic backup you can add this script to crontable of your host.

#!/bin/bash
DB=mu
WPMU_ROOT=/srv/www/mu-blogs

dirname=mu-backup-`date +”%m-%d-%y”`
cd /tmp
tmpdir=${dirname}

email=foo at bar . com

/bin/cp -R $WPMU_ROOT $tmpdir
/usr/bin/mysqldump mu > $tmpdir/db_backup.sql

/usr/bin/tar cfz $tmpdir.tgz $tmpdir

echo “Backup of WPMU $dirname” | /usr/bin/mail $email -s “WPMU Backup $dirname” -a $tmpdir.tgz
rm -rf $tmpdir*

Category: Blog Software, WordPress, web hosting

Tagged: , , ,

Leave a Reply