Have a Question?

If you have any question you can ask below or enter what you are looking for!

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. This functionality is useful for backups. 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 that you can install to 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

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. 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 favourite editor. 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. It’s recommended that you create another user for security reasons.

Copy any file to ‘~/Dropbox’ directory and it will be synchronized promptly to Dropbox cloud.

Add a cron job to synchronise certain directories automatically within the specific time frames. If it does not sync, try to share using Dropbox web interface.

Leave a Reply

You must be logged in to post a comment.