Backup Databases

dreamobjects

#1

So I’m using the following code (provided by DreamHost and tweaked a bit) to backup an important SQL database:

domains=( domain.com )
sqldbs=( db1 )
opath=$HOME/backup/
mysqlhost=mysql.domain.com
username=user1
password=password1
suffix=$(TZ="US/Eastern" date +%m-%d-%Y_at_%r)
for (( i = 0 ; i < ${#domains[@]} ; i++ ))
do
	cpath=$opath${domains[$i]}
	if [ -d $cpath ]
	then
		filler="just some action to prevent syntax error"
	else
		echo Creating $cpath
		mkdir -p $cpath
	fi
	mysqldump -c -h $mysqlhost --user $username --password=$password ${sqldbs[$i]} > ${cpath}/${sqldbs[$i]}_$suffix.sql
done

Instead of outputting this onto my main hosting account, I’d like to output it to my DreamObjects account. Any ideas on how this can be accomplished?


#2

Off the top of my head, I’d add in a bit to that script to use boto-rsync to copy the DB up to DreamObjects and then delete it.


#3

Any idea on how to get the boto-rsync to work? I was messing with it last night and couldn’t get it to work.


#4

It looks like boto-rsync doesn’t accept a stream input. To use it, you can add something like this under the mysqldump.