(please note, not all these ideas came from me, I came across a few sources from internet and just put it together and make it work for me)
1. install dropbox on linux, see http://www.dropboxwiki.com/Text_Based_Linux_Install#Post-installation, I use folder /var/backup/Dropbox as dropbox folder.
2. use crontab to backup mysql and web content to dropbox folder, use compression to reduce bandwidth usage.
3. you can also you crontab to remove old backup files automatically.
purgeDropbox.sh:
crontab entries:#!/bin/bash# limit on the size (in KB) of the directorylimit=1572864adminmail=webmaster@yourdomain.com# if directory exists, find out it's sizeif [ -d /var/backup/Dropbox ]thensize=$(/usr/bin/du -sk /var/backup/Dropbox | cut -f1)elseecho "/var/backup/Dropbox is invalid !!!" | /bin/mail -s "Invalid directory" $adminmailexitfi# if directory size is greater than limit, alert the userif [ $size -gt $limit ]thenecho "Data volume in your user home dir /var/backup/Dropbox with a total size of ${size} kB exceeds the maximum limit of $limit kB (1.5 GB) ! Please take action!" |/bin/mail -s "user home dir exceeds max limit" $adminmailfind /var/backup/Dropbox/redmine -name "*.gz" -mtime +30 -exec rm {} \; >> /root/purge.log 2>&1fi
30 20 * * * mysqldump -u root -pPASSWORD --databases db1 db2 |gzip >/var/backup/Dropbox/database_$(date +\%Y\%m\%d__\%H:\%M:\%S\%z).sql.gz
00 19 * * * /root/purgeDropbox.sh
00 22 * * * /bin/tar czfv /var/backup/Dropbox/web_$(date +\%Y\%m\%d__\%H:\%M:\%S\%z).tar.gz /var/www