Welcome to World Wide Wood, the online home of Peter, Rebecca and Catherine Wood.

Individual Entry Archive

Navigation

Backup Scripts

Here are the scripts I mentioned in Backup Strategy.

rsync_backup

Download rsync_backup.

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.

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!


By Peter | 07.13.2006 | 09:19 PM | Permalink | Categories: Code, Techie | 3 Comments

prwdot.org is hosted at Site5.com. Our blog is powered by WordPress. This page was built with 15 queries in 0.337 seconds.