#!/bin/bash SSH=/usr/bin/ssh KEY=/home/mach5/.ssh/sckey RUSER=login RHOST=mydomain.com DATE=`date +"%F-%R"` MPATH=/home/mach5/shuttercal/scdb/ MDUMP=mysqldump PRUNE=/home/mach5/cron/fileprune PORT=22 $SSH -i $KEY -p $PORT $RUSER@$RHOST $MDUMP db_schema > $MPATH$DATE $PRUNE -e 1.3 -s 5G $MPATH*so, running through this, i set up ssh keys between mydomain and mybackupserver. this script is cronned on mybackupserver, and runs mysqldump remotely over ssh. the dump is then captured in a file named for the date (ex: 2009-04-10-08:00). after this, i run a perl script i found called fileprune which deletes files selectively, in my case, the dir maxes out at 5 gigs, and deletes files on an exponential curve. I also have, on mydomain, a script to validate if a server other than the one allowed is trying to use my keys.
#!/bin/bash
# /usr/local/bin/backup-remote-mysql
ssh REMOTEUNIXUSER@TARGET_HOST "mysqldump -uMYSQLUSER -pMYSQLPASSWORD TARGET_DB |gzip -f" > TARGET_DB-dump.gz
backup_script /usr/local/bin/backup-remote-mysql TARGET_HOST/backup/mysql/You are not logged in, either login or create an account to post comments
You should be able to use cron, mysqldump, gzip, and scp to do everything you need.
posted by christonabike at 7:34 AM on April 10