Sync data with Dropbox on CentOS VPS
By rockia on Aug 30, 2012 with Comments 3
Dropbox comes very handy when we want to synchronize data among difference desktops, laptops or even mobile devices. It’s quite easy for Windows and Mac users; all they need to do is download and install the Dropbox software then sign in with the proper credential. Yet, if you are running CentOS, it’s not as easy, but I am not going to show you how to do it step by step. Instead, one of my friends in China implemented a script that allows you to install Dropbox and sync data on CentOS easily.
OK, Let me briefly tell you what this script is going to do so when you are working on it, you know what you are doing. The first we use this script, we will pass in parameter “install” to it and the script will automatically download appropriate version of Dropbox and install it for you. Then we are gonna run it without this parameter and the script will copy files from the source folder (the folder you want to back up) to the Dropbox folder and Dropbox will do the rest for you.
According to the developer LingXi, you are free to copy, distribute and transmit or adapt the work, but please NO COMMERCIAL USE. Use under the the CC BY-NC-SA 3.0 LICENSE.
- Make sure you have a Dropbox account. If you don’t already have one, you can register a Dropbox account for FREE. (I will be much appreciated if you can use my referral link to sign up so I will get some more space)
- Download “dropbox_sync.sh”
- There is something you need to change in the file before you can move on.
***If you don’t plan to back up MySQL database, you can simply comment out the Line #76
Line#25: Please change the path inside quotation to the folder you would like to backup.
Line#32,33: These two lines are for your MySQL database credential.
Line#35:Change it to the name of the databases you want to back up. If you have multiple database that you would like to back up, just separate them with space.
Line#30: This is the path to your mysqldump, if you don’t know it, please use “updatedb && locate mysqldump” to find out the correct path - To install Dropbox on CentOS, navigate to the folder containing this downloaded file. And type the following command:
chmod +x ./dropbox_sync.sh
./dropbox_sync.sh install - Now the script will find the suitable Dropbox version for you and install. After it’s done, you will see a message keep poping up on your screen saying that you need to verify your account and make the connection. You can simply copy the link to your browser and sign in with your Dropbox credential. Once you have done that, your VPS should confirm that your CentOS is now successfully linked with your Dropbox.
- Before we start syncing data to Dropbox, it’s also recommended you increase the wait time on Line#65 from “10m” to “60m” because it usually takes longer for first time back up and sync.
- Now we can start syncing data with Dropbox, just simply type in the following command line:
(./dropbox_sync.sh &)
**You can also use the line without the quotation, but if you keep the quotation on, the script will continue running even if you disconnect the SSH connection with CentOS.
AND THAT’S IT! You should be able to see files are being copied, generated (databases), and synced.
Once the files are backup for one time, you can reset the time from “60m” to “10m”.
Please let me know if you have any comments or suggestions.
Filed Under: Operating Systems
It’s good to see my script helps someone. XD
Thank you both a lot! This is exactly where I was looking for
its not working with my crontab -_-