Ubuntu安装oneDrive
安装oneDrive
wget -qO - https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_20.04/Release.key | sudo apt-key add -
echo 'deb https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_20.04/ ./' | sudo tee /etc/apt/sources.list.d/onedrive.list
sudo apt-get update
sudo apt install onedrive
修改配置
文件同步路径可以修改config文件中的sync_dir参数
更新间隔时间可以修改config文件中的monitor_interval参数
// 生成配置目录
mkdir -p ~/.config/onedrive
// 下载配置
wget https://raw.githubusercontent.com/abraunegg/onedrive/master/config -O ~/.config/onedrive/config
// 修改配置
vi ~/.config/onedrive/config
创建log文件
sudo mkdir /var/log/onedrive
sudo chmod 777 /var/log/onedrive
sudo usermod -a -G users <your-user-name>
配置云端账户
命令行输入onedrive
,会弹出认证网站,复制网址在浏览器中打开,并登陆,登录成功后再将最后的网址粘贴回来,显示成功即可
开始同步
// 在正式运行前,可以先输入下列命令看看运行结果而不对系统产生变化,即dry run.
onedrive --dry-run --synchronize
// 如果dry run符合你的预期,那么便可以正式运行啦,输入下列命令.
onedrive --synchronize --verbose --resync --local-first
启动后台服务
将文件下载好,初始化完毕后,执行以下命令开启自动同步功能
普通用户
systemctl --user enable onedrive
systemctl --user start onedrive
# 查看日志
journalctl --user-unit=onedrive -f
root用户
systemctl enable onedrive
systemctl start onedrive
# 查看日志
journalctl --unit=onedrive -f
//开启后台服务
systemctl --user enable onedrive
// 开启
systemctl --user start onedrive
// 停止
systemctl --user stop onedrive
//查看日志
journalctl --user-unit=onedrive -f