About this user

ludo http://asiatica.org/~ludo/

« Newer Snippets
Older Snippets »
1 total  XML / RSS feed 

Daily rotated backups to Strongspace

#!/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/*
« Newer Snippets
Older Snippets »
1 total  XML / RSS feed