Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Daily rotated backups to Strongspace (See related posts)

#!/bin/bash

# backup folder
HOME=/users/home/myid
DEST=$HOME/backups
MYSQL_DATABASES="db1 db2 dbn"
DIRS="dir1 dir2 dirn"
[email protected]

BACKUP_ALT=$(python -c "import time, sys; sys.stdout.write(str(int(time.strftime('%d')) % 2))")

for d in MYSQL_DATABASES; do
mysqldump --quick --opt --skip-add-locks $d |gzip - >${DEST}/${d}.sql.gz
done

for d in DIRS; do
tar zcvf ${HOME}${DEST}/${d}.tar.gz ${HOME}/${d} >/dev/null
done

scp -r ${DEST}/* ${STRONGSPACE_USER}:backup/$BACKUP_ALT/

rm -rf $DEST/*

Comments on this post

ludo posts on Apr 28, 2006 at 07:08
TODO:
* test the script :)
* detect missing dirs and create them

You need to create an account or log in to post comments to this site.


Related Posts