Backup Scripts

Here are the scripts I mentioned in [Backup Strategy](http://prwdot.org/2006/07/12/backup-strategy/).

**rsync_backup**

Download [rsync_backup](http://prwdot.org/code/rsync_backup.txt).

The config file format for this script looks like the following:

description|A description of the backup you're performing
rsync_source|The source server or directory (What you're backing up from)
rsync_target|The target server or directory (What you're backing up to)
rsync_options|Any options you wish to pass to rsync
(Type 'man rsync' at your command line for more info)
logfile|Name of the file to which you wish to log the script's activities

To run the script, simply execute it at the command line and pass the path to the config file as an argument. For example:

./rsync_backup /home/peter/website.cfg

Here are the config files I use:

prwdot.cfg — backs up my web host to my home directory

description|prwdot.org
rsync_source|--myusername--@--myhostname--:/home/prwdotor
rsync_target|/Users/prw/prwdotbackup
rsync_options|-a -u -C --stats
logfile|/Users/prw/backup/logs/prwdot.log

prw.cfg — backs up my home directory to the media drive (aka miniStack)

description|prw Home Directory
rsync_source|/Users/prw
rsync_target|/Volumes/miniStack/prw_backup
rsync_options|-E -a -u -C --stats
logfile|/Users/prw/backup/logs/prw.log

miniStack.cfg — backs up the miniStack to the backup drive

description|miniStack
rsync_source|/Volumes/miniStack
rsync_target|/Volumes/miniStackBackup
rsync_options|-E -a -u -C --stats
logfile|/Users/prw/backup/logs/miniStack.log

**dump_mysql**

To revise what I had stated in my previous post, this script doesn’t actually use config files at the moment. As you will see, it simply uses variables embedded within the script. I can convert it to use a config file easily enough… if I do so, I’ll update this post with that information.

Download [dump_mysql](http://prwdot.org/code/dump_mysql.txt).

To run it, simply execute the script and pass the name of the database you wish to dump to a config file. For example:

./dump_mysql wordpress

I hope that you find these scripts to be useful… let me know if you have any questions about them!

3 thoughts on “Backup Scripts

  1. Peter Post author

    I think you must have missed the earlier post where I mentioned that Becky and Catherine were away for the week! No way for me to post pictures of her if she\’s not here! Don\’t worry though, I\’m down on the island with them this weekend, and there will be plenty of photos when we get back. 🙂

    Reply
  2. Ken F

    You do know that Google has these satellite images? You could try getting a shot of Catherine from one of those at least!! 🙂

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *