Install Dropbox for Headless Servers

Install Dropbox for Headless Servers

2016-12-03. Category & Tags: Dropbox, Headless, Servers

ref-DigitalOcean

Install & Run #

64 bit:

# tmux
cd ~
wget -O dropbox-linux-x86_64.tar.gz https://www.dropbox.com/download?plat=lnx.x86_64 && \
sudo mkdir -p /opt/dropbox && \
sudo tar xzfv dropbox-linux-x86_64.tar.gz --strip 1 -C /opt/dropbox && \
sudo ln -s /opt/dropbox/dropboxd /usr/bin/dropboxd

dropboxd &

for 32 bit OS the url is: xxxx?plat=lnx.x86

Install Command Line Interface (CLI) [Optional] #

cd ~
sudo wget -O /usr/bin/dropbox.py https://www.dropbox.com/download?dl=packages/dropbox.py && \
sudo chmod +x /usr/bin/dropbox.py && \
ln -s /opt/dropbox ~/.dropbox-dist && \
dropbox.py status # run CLI

see CLI usage in ref

Auto Start as a Service in Ubuntu #

sudo touch /etc/systemd/system/dropbox.service && \
sudo chmod 777 /etc/systemd/system/dropbox.service && \
ll /etc/systemd/system/*.service* && \
sudo vim /etc/systemd/system/dropbox.service

# set paste
[Unit]
Description=dropboxd
After=network.target

[Service]
Type=notify
Restart=on-failure
ExecStart=/usr/bin/dropboxd &

[Install]
WantedBy=multi-user.target

Auto Start (as root) in Old Ubuntu #

sudo wget -O /etc/init.d/dropbox https://gist.githubusercontent.com/thisismitch/d0133d91452585ae2adc/raw/699e7909bdae922201b8069fde3011bbf2062048/dropbox && \
sudo chmod +x /etc/init.d/dropbox && \
echo 'DROPBOX_USERS="root"' | sudo tee -a /etc/default/dropbox && \
sudo service dropbox start && \
sudo update-rc.d dropbox defaults

OBS: space-separated sys usernames for multi users, see ref-DigitalOcean for details.
Tip: for other systems, see here

FAQ #

To ignore files/folders:

nix:

sudo apt-get install attr
attr -s com.dropbox.ignored -V 1 /some\ \(Personal\)/path/Dropbox/blog-sunny/hugo-blog/public/

win:

Set-Content -Path 'C:\Users\yourname\Dropbox(Personal)\YourFileName.pdf' -Stream com.dropbox.ignored -Value 1