This was only tested on Fedora 35 with systemd but should work on any WSL distribution that uses systemd.
Install the Dropbox headless client:
$ cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
Install the Dropbox manager script into your ~/bin
folder:
$ wget -O ~/bin/dropbox https://www.dropbox.com/download?dl=packages/dropbox.py
$ chmod +x ~/bin/dropbox
Create a systemd unit to start Dropbox automatically (somehow dropbox autostart
has no effect):
$ mkdir -p ~/.local/share/systemd/user
$ cat > ~/.local/share/systemd/user/dropbox.service <<EOF
[Unit]
Description=Dropbox Daemon
After=network.target
[Service]
Type=simple
ExecStart=/home/YOUR_USERNAME_HERE/.dropbox-dist/dropboxd
ExecStop=/bin/kill -HUP $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target
EOF
$ systemctl enable --user dropbox
$ systemctl start --user dropbox
Additionally, configure the download/upload limit:
$ dropbox throttle unlimited unlimited
You can use $USER instead YOUR_USERNAME_HERE and maybe needs escape $MAINPID.
BTW, user level not worked for me, this one worked: https://www.linuxbabe.com/ubuntu/install-dropbox-headless-ubuntu-server
But with some changes like the path to dropboxd