This Guide To Copy Backup Files From Server to DropBox Cloud, is Tested on HP Cloud & Will Work on All Servers including OpenStack Instances. There can be hundreds of problems with web content – web host issues, hacker attacks, migration, any disaster. For within the same datacenter, in case of OpenStack, OpenStack Raksha and Floating IP is the method of choice.
Copy Backup Files From Server to DropBox Cloud (HP Cloud)
This is file level backup. You can indeed upload the snapshot image to DropBox. We do not recommend to keep the method simple, easy to detect any security issue. If you need temporary or permanent migration, at least the website’s MySQL or any Database Backup and backup of the other files are very basic need to restore the website.
You must test the backups. Darren Rowse (
problogger.net) has excellent articles for tips on Backup. Web Hosts are dangerous, particularly for the Non-US residents using US servers, always use multiple ways of backing up the website. If you do not have the backup, you will only get the texts from Google Cache and Way Back Machine. Always keep the meta
index for this lifeboat.
We can not buy the servers, we are tenants on rent. DropBox Cloud Storage has a basic advantage – it has a free usage tier. You always need a free usage tier if you are living outside of US. If your payment method fails, that free cloud storage which you never cared will appear as Angel.
We are showing 100% manual method to copy backup files from server to DropBox Cloud Storage. Manual method is best as you can see what you are doing. First plan carefully what are mandatory files to restore the site, move them to a new directory, suppose named
~/backup, inside that directory, copy the essential files using
cp command. An example structure :
If you have WordPress, use WordPress database backup plugin, then the SQL backup will remain in
wp-content directory. Then zip it and upload to dropbox if you dislike flat files to go to somewhere. You can add password if you zip in this way from SSH :
zip --encrypt yourfile.zip your files
To restive the files, rather to restore, you can use the “Share Link” of DropBox to retrieve the direct link to the file using
wget. Do not forget the password! Try to make separate small directories & keep the size of the zips smaller. Do not use too much complicated password, if keyboard mapping disturbs, you’ll get in to solid trouble to restore.
The script supports a download option as command, apart from wget.
Copy Backup Files From Server to DropBox Cloud Storage : Steps
Definitely you have DropBox Cloud Storage Account with sufficient storage. We have
18.25 GB by referrals earnings from our website guides’ links to register for DropBox. It is enough to have a bigger website’s backup fully free of cost. Let us start.
There is an excellent bash script named Dropbox Uploader,
wget it and
chmod it :
chmod +x dropbox_uploader.sh
Here is the actual Git of that script :
If you need automated work, then you’ll read it, else our guide is sufficient. Run the script now :
at this point, you need to create an API based Dropbox App. If you search on Google Web Search with “Create Dropbox API App”, you will get some link like this :
Open that webpage on Browser, select
Dropbox API app as option and proceed. In very short, the App need to be fully permissive. Options changes when Dropbox upgrades their API, at the time of publication of this guide, you need to select – “No ” My app needs access to files already on Dropbox.” and “All file types ” My app needs access to a user’s full Dropbox.” options and create the App. You are the only user, there will be one
App key and one
App secret, you need only these two things for completion of the steps on SSH.
It is simple and easy. Take time and create it. After you supply on SSH, you will get exactly these things copied from SSH :
App folder [a]: If you choose that the app only needs access to files it creates
Full Dropbox [f]: If you choose that the app needs access to files already on Dropbox
# Permission type [a/f]: f
> App key is ABCD, App secret is XYZ and Access level is Full Dropbox. Looks ok? [y/n]: y
> Token request... OK
Please open the following URL in your browser, and allow Dropbox Uploader
to access your DropBox folder:
Press enter when done...
https://www.dropbox.com/1/oauth/authorize?oauth_token= URL on browser. Your setup will be complete. To list the directories present on Dropbox, execute :
Uploading is easy :
./dropbox_uploader.sh upload <file-name-on-ssh> <top-dir-name-on-dropbox>
For our example structure on the server, if you have created a directory on Dropbox named Backup, command can be :
./dropbox_uploader.sh upload /path/to/yourfile.zip Backup
Test with small files. Now, it is basically risky to run the command to upload bigger files. If you get disconnected from SSH, things may go wrong! So, we need to create a cron. Evoke cron by running :
This is how the structure of cron goes :
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 6) (Sunday=0 or 7)
# | | | | |
* * * * * command to be executed
So, if we add :
0 2 * * * /path/to/dropbox_uploader.sh delete Backup/back-up-file.zip; /path/to/dropbox_uploader.sh upload /path/to/back-up-file.zip Backup
0 2 * * * -> every day at 2 am
/path/to/dropbox_uploader.sh delete Backup/back-up-file.zip -> normal command to delete the old upload
/path/to/dropbox_uploader.sh upload /path/to/back-up-file.zip Backup -> normal command to upload the updated stuff
It can be dangerous – if you delete the server dir, Dropbox have nothing! Cron will not work in that case of emergency, you need to use a script like this to keep it executing the even after you have logout from your session (take it as
chmod it to become executable by running
chmod +x upload.sh command.
/path/to/another/script.sh is the command-full script (take it as
script.sh) like this :
sudo -u root ./dropbox_uploader.sh upload <file-name-on-ssh> <top-dir-name-on-dropbox>
First test the script by executing it manually :
chmod +x script.sh
If you run :
nohup ./script.sh &
the command will continue doing even if you log out from SSH. If you run :
nohup ./upload.sh &
then the script will run every 5 minutes even if you log out from SSH. We have created a Github repo here for you, so that, you do not need to copy-paste.
Follow the Author of this article :