Dropbox is great. Most of the time. It's great when I need to easily share files with people while working on a project together. It keeps files in sync between multiple computers, and is the only solution I've found so far which works seamlessly and instantaneously. If you don't already use it, I highly recommend it.
I've recently been having problems with Dropbox ever since joining a shared folder which overflowed my quota. Completely unrelated files mysteriously disappeared. Luckily I had a snapshot from before I had joined the folder and was able to restore the files.
This prompted me to set up a proper backup system which makes snapshots daily, weekly and monthly.
This guide assumes you have a Linux server somewhere with no GUI.
First, follow the Dropbox wiki instructions for installing Dropbox on Linux. The process is relatively painless, and seems to just work. At the end, you'll end up with a "Dropbox" folder in your home folder. This folder will always have the latest version of your files.
The next step is to take snapshots of that folder at regular intervals. I chose to keep 7 days of daily snapshots, 4 snapshots taken weekly, and 12 taken monthly. In theory, this should give me access to any files I've accidentally deleted within the past year.
This script will run rsync to clone the Dropbox folder into snapshot folders which will be overwritten over time, so you will only end up with 7+4+12 copies of your Dropbox folder. Save this code to a file called backup.sh or whatever you want, and make it executable (chmod 755 backup.sh).
#!/bin/bash # Makes daily snapshots in folders like "daily-4-Thu", "daily-5-Fri" if [[ "$1" == "daily" ]] then path=daily-`date +%u-%a` fi # Makes weekly snapshots in folders like "weekly-1" where 1 is the day of the month if [[ "$1" == "weekly" ]] then path=weekly-`date +%d` fi # Makes monthly snapshots in folders like "monthly-04-Apr" if [[ "$1" == "monthly" ]] then path=monthly-`date +%m-%b` fi # Run with "go" as the second CLI parameter to actually run the rsync command, otherwise prints the command that would have been run (useful for testing) if [[ "$2" == "go" ]] then rsync -avz --delete /home/aaron/Dropbox /home/aaron/aaron/Dropbox-Backup/$path else echo rsync -avz --delete /home/aaron/Dropbox /home/aaron/Dropbox-Backup/$path fi
Add these lines to your crontab to run the backup script at the appropriate intervals. This will run the daily script every night at 1am, the weekly script on the 4th, 12th, 20th and 28th days of the month at 1:30am, and the monthly script on the 1st of the month at 2am.
0 1 * * * /home/aaron/backup.sh daily go 30 1 4,12,20,28 * * /home/aaron/backup.sh weekly go 0 2 1 * * /home/aaron/backup.sh monthly go
Hopefully this saves you some headaches down the road when Dropbox decides to play tricks on you.