Guide for Using Dropbox CLI for Backup Sync
As a free service, Dropbox allows you to synchronize and share data globally using any computer or mobile device. Generally, this functionality is useful for backups. However, you can use Dropbox CLI (Command Line Interface) in any text-based Linux environment, simplifying data safety considerably. The important pre-requisite is Python 2.6 or higher you can install it in a separate directory that will not break your current Python installation.
If you have already registered at www.dropbox.com, follow the simple steps below to get the whole thing running.
1. Get your shell prompt and download the archive corresponding to your server architecture:
wget http://www.dropbox.com/download/?plat=lnx.x86
or
wget http://www.dropbox.com/download/?plat=lnx.x86_64
After that, use arch or uname -i command to determine the hardware platform you are running.
2. Extract the archive and run dropboxd:
tar xzvf dropbox-lnx.x86_64-1.1.45.tar.gz
https://www.dropbox.com/cli_link?host_id=0108897c509a892ddf803303f5fc5000&cl=en_US
3. You will see this output message:
This client is not linked to any account.
Please visit https://www.dropbox.com/cli_link?host_id=3d34y857ar54*** for linking this machine.
Copy that URL and paste it in your web browser. Verify your account by typing your Dropbox password.
This server is now linked to your account. You can manage it through the web interface (Account -> My Computers tab). The directory ‘~/Dropbox’ is also created on the server. After all, this will cause your files to start syncing right away.
4. Next we’ll perform some steps to apply easy-to-use principles of administering the Dropbox installation.
Download the following script to one of your $PATH directories.
cd /usr/bin wget http://www.dropbox.com/download?dl=packages/dropbox.py mv dropbox.py dropbox chmod 0700 dropbox
5. Type ‘dropbox’ to view all available options provided by this script.
If you see ‘invalid syntax’ errors while running this script, open the script with your favorite editor. Also, edit the line ‘#!/usr/bin/python’ to match your valid Python 2.6+ installation path.
6. As a Dropbox user, you should know the ‘LAN sync’ option. Disable the feature since you most likely do not manage a LAN. Use the following commands:
dropbox stop cd /usr/bin wget http://dl.dropbox.com/u/340607/pyDropboxValues.py chmod 0700 pyDropboxValues.py ./pyDropboxValues.py wget http://dl.dropbox.com/u/340607/dropbox_set_lansync.py chmod 0700 dropbox_set_lansync.py off dropbox_set_lansync.py dropbox start
7. Enable autoloading and create the init script.
Debian-based distributive (like Ubuntu):
cd /etc/init.d wget http://dl.dropbox.com/u/17184781/bin3/dropbox_debian mv dropbox_debian dropbox chmod 0700 dropbox update-rc.d dropbox defaults
RedHat-based distributive (like CentOS):
cd /etc/init.d wget http://dl.dropbox.com/u/17184781/bin3/dropbox_redhat mv dropbox_redhat dropbox chmod 0700 dropbox echo 'DROPBOX_USERS="root"' > /etc/sysconfig/dropbox chkconfig dropbox on
Where ‘root’ is the user under which you run your Dropbox. Generally, it’s recommended that you create another user for security reasons.
Copy any file to ‘~/Dropbox’ directory and it will be synchronized promptly to the Dropbox cloud.
Add a cron job to synchronize certain directories automatically within specific time frames. If it does not sync, try to share using Dropbox web interface.