Being the thoughts and writings of one Gustaf Erikson; father, homeowner, technologist.

This category is about weblogging metadiscussions

Friday, 2005-08-19


Gmail backups

You can back up your Wordpress blog to gmail: here’s a post that explains how.

I’ve been doing this since October last year, here are some gotchas related to that.

This is my setup.

  • Blosxom blog
  • shell account on the blog server
  • gmail address
  • bash shell scripting nous

I run the following script from cron:

#!/bin/sh
HOME=/home/gustaf
DIR=$HOME/backup
DATE=`date +"%Y-%m-%d"` 
FILE=blog-$DATE.tar.gz
MUTT=/usr/bin/mutt
# save crontab 
crontab -l > $HOME/save/crontab
# create backup file
tar czf $DIR/$FILE --exclude public_html/files/big  \
blosxom-data blosxom-plugins public_html bin save
# mail the file
echo ""| mutt -a $DIR/$FILE -s "backup $DATE" <my email>[email protected]

This zips up my blog and plugins, the bin directory, all CSS and .htaccess files, the crontab and my blogroll, and all smaller pics in a tar file. This is then sent to gmail. mutt makes it easy to send attachments from the command line.

The process leaves a bunch of files in the backup directory. This needs to be periodically pruned.

As of today, the backup file is 1.3M. According to the comments to the post referenced above, the gmail limit is 10M. You can add a check if your file gets bigger.

Make sure you can check the mail to the account you’re sending from, if the mail to gmail bounces you want to know about it.

Submit a comment

Please enter comments as plain text only; HTML is not supported. Submitting an URL is optional.

Comments are moderated and may not appear immediately.

Comments are closed for this story.