Dropbox

Dropbox: Automatic Ubuntu Server Snapshot

I want to turn Dropbox ON every day for it to be able to Sync to my server between 2 and 4 AM, to get synced up with all the changes made on the day.

0 2 * * * /sbin/start-stop-daemon -b -o -c user -S -u user -x ~/.dropbox-dist/dropbox

0 4 * * * /sbin/start-stop-daemon -o -c user -K -u user -x ~/.dropbox-dist/dropbox

 

NOTE: "user" needs to be replaced by the Ubuntu user running the Cron command

To do a Tar Ball

30 4 * * * tar cvzf /home/backups/Dropbox/backup_`date +\%Y.\%m.\%d_\%H:\%M:\%S`.tar.gz /home/rmalla/Dropbox/Soporte

 

After doing this, I will do a rsync, to take a snapshot of this changes and store it on one of my servers HD.

SSH COMMAND

sudo rsync -azvv /home/rmalla/Dropbox/Soporte /home/rmalla/backup/Dropbox/`date +%Y.%m.%d_%H:%M:%S`/

Remember that for some reason the CRONTAB has some weird problem with the dates on the filename so to make it work we need to add the back slash:

30 4 * * * /usr/bin/rsync -azvv /home/rmalla/Dropbox/Prueba /home/rmalla/backup/Dropbox/`date +\%Y.\%m.\%d_\%H:\%M:\%S`/

 

To determine how big the folder is:

du -h /home/rmalla/backup/Dropbox | grep ^[5-9.]*G

Next Steps...

  • Limit the amount of snapshots to 5 consecutive days (as every snapshot is 10 GB). 
  • Keep one weekly snapshop for the past 2 months
  • Keep one monthly snapshot for the past year.
Attachments:

Leave a Reply

Your email address will not be published. Required fields are marked *