Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Completely Automate backing up to Dropbox - (Databases + Files) !
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Completely Automate backing up to Dropbox - (Databases + Files) !

partymongerpartymonger Member
edited August 2014 in Tutorials

Most of us have a harrowing time backing up our servers.

Here's an easy way. Assuming you are operating as root user.

1) Making the scripts
https://gist.github.com/n2j3/5276729

Copy this script, fill in the relevant details, include the relevant paths to backup and make backup1.sh script ( make a txt file, paste in notepad and then save as backup1.sh).

Go here -> https://github.com/andreafabrizi/Dropbox-Uploader
And download dropboxuploader.sh

Put them both in /root/

Assuming you made the first script in windows and simply downloaded the second one (dont need to edit the second one) you will need to change the encoding of backup1.sh to linux using the sed command

sed 's/\r$//' /root/backup1.sh /root/backup.sh

Now delete backup1.sh

2) Running the scripts and putting them in action?

Run backup.sh
/bin/bash /root/backup.sh

Now it will ask you to open dropbox account, create an app, name it, give it complete or single folder access, and then copy the Api keys. All the steps will be shown, its pretty straight forward.

Once this has run it will save the api keys and details so you wont have to save them again.

3) Automate it!

Make a cron job for this to execute this on a routine of your liking.

Use this - https://www.digitalocean.com/community/tutorials/how-to-use-cron-to-automate-tasks-on-a-vps

Take a minute to go through it. The commands are simple and very effective. I also hooked it up to email me (you can find how to email in the same tutorial)

I have fixed it to run everyday at 6am incase even i work late night the work is saved right before I go to sleep. So its saved like 29 August, 14.tgz to the application's dropbox folder. Remember the $now in first script will make a day's file(like above). So if you are saving multiple times a day you might want to change that to something that includes hours in the file name so its unique and doesn't get overwritten.

4) Sitback and relax
So once you have done that. You can sit back and relax cause dropbox will do the heavy lifting while you relax without worrying much about bad providers.

Incase in the future it stops working, the whole dropbox procedure is in the second script. Just use the same link above and download the new file and paste it in the older file's place. The maker of the script is awesome and keeps it updated.

Let me know if there can be variations of this. I am a linux noob and spent a lot of time figuring things out and thought i'd spread the joy here.

Dropbox has introduced 1TB backup for 10$ per month. So for 10$ a month, most of us with not a lot of data heavy vps can save a tonne of stuff there.

The First script also has a way to identify backups from multiple VPS/boxes. Just incase you have a lot of them, that will save you lot of time.

At the moment of writing this my backups are 50mb and the space on dropbox is 15gb (through referrals) So I can schedule cleaning up the dropbox account once a month and save weekly backups only.

Thanked by 1linuxthefish

Comments

  • Why not use Duplicity using the Dropbox backend?

  • Is it me or does dropbox have slow upload speeds to EU? I'm only getting around 0.3MB/s on iftop while uploading on the free account :(

  • If duplicity works for you, that's great! This I felt was simple and flexible.

    I considered the dropbox linux app too with symlinks. This was by far the simplest out there.

    Also helped me get a great understanding of linux and crons. Not everyday, I have so much fun learning something. :D

  • Caveman122Caveman122 Member
    edited August 2014

    @linuxthefish said:
    Is it me or does dropbox have slow upload speeds to EU? I'm only getting around 0.3MB/s on iftop while uploading on the free account :(

    Not just you, Dropbox is extremely slow when it comes to download/upload. (I stopped using it 6 month ago) Besides it has only 2GB storage space by default. If you are going to use a cloud storage like dropbox, why not use google drive? 15GB to begin with and 100GB for only $1.99.

    P.S. try this, it's extremely easy to setup and use. It supports most common databases backup, optionally compress the backup and encrypt it. Store/upload it to a pretty much every service out there and email you the results. It's working out great for me thus far.

    http://meskyanichi.github.io/backup/v4/

    Thanked by 1jvnadr
  • jbarrjbarr Member
    edited August 2014

    Do you see any reason why this concept would not work using Bittorrent Sync to store the save set to another VPS instance? I installed BTSync on one of my Ubuntu VPS instances, and so far it works like a charm syncing with my Windows boxes at home, so the mechanics seem to be solid. Given that BTsync is only limited by local storage, as long as you have the HDD and bandwidth capacity, it should work.

    Thoughts?

  • ATHKATHK Member

    I get around 2-3 mb up and around 10 down from Iniz Los Angeles I believe.

    Using Dropbox with symlinks

  • @jbarr - There are a tonne of players here Copy.com is the most generous, google drive, btscync and a few more. Most involve running an app. Common opinion across the threads I read is that running an extra app, opens up more vulnerabilities.

    Maybe if you are really interested, find a way to make it work. The procedure of dumping the sql and backing up the files and making an archive remains the same. Next you can maybe copy it to the folder which the sync app syncs to the cloud.

  • mikhomikho Member, Host Rep

    Dropbox (if they haven't changed it) saves each version of a file for you so there "shouldn't" be a need for renaming the files. You ahve to grab the file via the webinterface to access previous versions.

    Like @partymonger said; there are many players on the "cloud storage" market and I find it easiest for me to create a dir on the vps and then symlink directories into it and let the app sync your files.

  • http://meskyanichi.github.io/backup/v4/

    Seem to be great script! I'll test it as soon as possible. It seem to combine simplicity with a ton of options!

  • Little_TarLittle_Tar Member
    edited September 2014

    If someone could make the similar uploader for Box.com. There have 50 Gb instead of poor 2 Gb, and they also have API.

  • Nice, thanks.

  • Or Amazon Glacier for their super-cheap storage price (or OVH Hubic which seems to be everyone's favourite these days).

  • @zhuanyi said:
    Or Amazon Glacier for their super-cheap storage price (or OVH Hubic which seems to be everyone's favourite these days).

    oh yes, for those of us who live on the moon with 28.8 dialup speeds.

Sign In or Register to comment.