Sync Linux folder with OneDrive

From Luniwiki
Jump to: navigation, search

Install prerequisites

apt install libcurl4-openssl-dev libsqlite3-dev git curl pkg-config snapd
snap install --classic dmd
2019-08-11T21:44:24-04:00 INFO Waiting for restart...
dmd 2.087.0 from D Programming Language (dlang) installed
snap install --classic dub
dub 1.15.0 from D Programming Language (dlang) installed

Install onedrive

git clone
cd onedrive/
checking for a BSD-compatible install... /usr/bin/install -c
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for dmd... dmd
checking version of D compiler... 2.087.0
checking for curl... yes
checking for sqlite... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating contrib/pacman/PKGBUILD
config.status: creating contrib/spec/onedrive.spec
config.status: creating onedrive.1
config.status: creating contrib/systemd/onedrive.service
config.status: creating contrib/systemd/onedrive@.service
if [ -f .git/HEAD ] ; then \
       git describe --tags > version ; \
else \
       echo v2.3.9-dev > version ; \
dmd  -w -g -O -J. -L-lcurl -L-lsqlite3  -L-ldl src/config.d src/itemdb.d src/log.d src/main.d src/monitor.d src/onedrive.d src/qxor.d src/selective.d src/sqlite.d src/sync.d src/upload.d src/util.d src/progress.d -ofonedrive
make install
/usr/bin/install -c -D onedrive /usr/local/bin/onedrive
/usr/bin/install -c -D onedrive.1 /usr/local/share/man/man1/onedrive.1
/usr/bin/install -c -D -m 644 contrib/logrotate/onedrive.logrotate /usr/local/etc/logrotate.d/onedrive
mkdir -p /usr/local/share/doc/onedrive
/usr/bin/install -c -D -m 644 config LICENSE docs/ docs/ docs/ docs/ /usr/local/share/doc/onedrive
/usr/bin/install -c -d -m 0755 /usr/lib/systemd/user /lib/systemd/system
/usr/bin/install -c -m 0644 contrib/systemd/onedrive@.service /lib/systemd/system
/usr/bin/install -c -m 0644 contrib/systemd/onedrive.service /usr/lib/systemd/use

Authorize account

Authorize this app visiting:

Copy the URL and login, and after copy the URL in the blank page of your browser

Enter the response uri:
--synchronize or --monitor missing from your command options or use --help for further assistance
No OneDrive sync will be performed without either of these two arguments being present

First run

onedrive --synchronize

Run as a service

Creation of file /lib/systemd/system/onedrive.service

cat onedrive.service
Description=OneDrive Free Client

[Service] ExecStart=/usr/local/bin/onedrive --monitor --enable-logging --upload-only --monitor-interval 1200 Restart=on-failure RestartSec=3 RestartPreventExitStatus=3

We enable and start the service

systemctl daemon-reload
systemctl enable onedrive
systemctl start onedrive
systemctl status onedrive


Daniel Simao 21:27, 11 August 2019 (EDT)