Trying it out with this plugin:
Not verified for WordPress 2.9.1r. Problem right now is that it cannot send the full backups by email because the PHP mail function dies.
Another option would be to backup to "the cloud." Skydrive is free, so thats a nice option. Otherwise Amazon S3 is very affordable.
This plugin
seems to do the trick for sql backup, but I don't know about content backup.
For now I'm going to try and separate the backup operations into smaller chunks so that we can just use gmail. I suspect that all the large files are stored in the theme directory.
Mission Status: Failure
Looks like this wordpress plugin doesn't allow me to specify particular directories to backup or exclude. Rather, I can exclude directories, but I cannot setup multiple backups so that everything is covered.
Next Approach: Cron-Job to upload files via FTP to g.ho.st
Nope that doesn't work either. Bluehost doesn't have working FTP. cUrl doesn't work, wput doesn't work, ftp doesn't work. They all fail to connect. Works fine on dreamhost!
Next Approach: Split files with a cron job and email using shell / php function
Using the split command:
split -b 24m -d big.tar.gz out.suffix
Actually sending
Sending is another chore. It can be done with the unix mail command, but decided that would be a bit too much work (you have to uuencode, and I don't think it can be downloaded as an attachment).
There was a mail-file command on the host, but it didn't work, complained about a linux command called "no" not existing. Dunno how I'm supposed to figure out what "no" is.
So I compiled mutt instead and am following these instructions:
the form I care about is:
mutt -s "Subject line" -a /path/to/attachment recepient@email.com < /tmp/message/body
But that didn't work by default on Bluehost, I had to make some changes to ~/.muttrc
I added
set sendmail = /usr/sbin/sendmail
to ~/.muttrc , no works! Can even send large, 25Mb files!
Bash hacking
To perform the split, mail, etc operations required a lot of bash hacking. Some sites proved indispensible:
Seems to work, script looks something like this:
#!/bin/bash
echo "##################"
echo "Greetings humans!"
echo " - backupsNeverSayNeverBlog.sh"
echo
echo "# @author: Colin Zwiebel"
echo "# @created: 6 Dec 09"
echo "#"
echo "# Backups the contents of the neversaynever.net blog"
echo "# Grabs the full backup tar, splits it into mailable sizes and send it to our "
echo "# gmail backup account."
echo "====Setting up constants"
target_email="backup@neversaynever.net"
backup_file_dir=~/public_html/wp-content/backup/
tmp_directory=~/tmp/
tmp_subdir=backup_split/
echo "====Getting the name of the most recent backup file"
latest_backup_tar=`ls -1 --indicator-style=none $backup_file_dir*full* | tail -n 1`
echo " - its named: $latest_backup_tar"
echo "====Isolating the name of the backup file (without path)"
latest_backup_tar_fn_only=`echo "$latest_backup_tar" | grep -oiE '/[[:digit:]]{4}.+\.tar\.gz$'`
latest_backup_tar_fn_only=${latest_backup_tar_fn_only:1}
echo " - filename alone: $latest_backup_tar_fn_only"
echo "====Clearing out temp space for file splitting"
clear_cmd="rm -rf $tmp_directory$tmp_subdir"
echo " - $clear_cmd"
#debug
#$clear_cmd
mkdir_cmd="mkdir $tmp_directory${tmp_subdir%%/}"
echo " - $mkdir_cmd"
$mkdir_cmd
echo "====Splitting the full backup into 25mB chunks"
split_cmd="split -d -b 25m $latest_backup_tar $tmp_directory$tmp_subdir$latest_backup_tar_fn_only"
echo " - $split_cmd"
#DEBUG
#$split_cmd
echo "====Getting number and name of backup segments"
ls_cmd="ls -1 --indicator-style=none $tmp_directory$tmp_subdir$latest_backup_tar_fn_only*"
#echo " - $ls_cmd"
parts=`$ls_cmd`
echo " - We found these segments:"
for f in $parts
do
echo " * $f"
done
echo "====Emailing backup segments"
echo " - To: $target_email"
timestamp=`date`
subject="NeverSayNever Backup Script: Full Backup on $timestamp"
echo " - Subject: $subject"
message="NeverSayNever Backup Script performing a full backup of NeverSayNever Wordpress
Timestamp: $timestamp
--The following backup file parts will be tranferred as separate messages:
$parts"
echo " --- Message: ---
$message
--- End Message ---"
for f in $parts
do
mail_cmd="mutt -s \"$subject\" -a $f $target_email"
echo " - about to send $f"
echo "$message" | $mail_cmd
echo " - send command executed"
done
echo "====Script done, c'ya folks!!!"
but... still need to get the cron jobs setup.
Oup, there done. More problems (naturally). Cron runs as root (whee) and so it didn't have settings from my .bashrc (namely the $PATH stuff). Using fully qualified path names did the trick.