安装Rclone进行挂载

安装Rclone进行挂载

curl https://rclone.org/install.sh | sudo bash

挂载到本地

centos需要下载fuse

yum -y install fuse
#新建本地文件夹,位置可以自己选
mkdir /data/aliyunwebdav
#挂载
rclone mount DriveName:Folder LocalFolder --cache-dir /tmp --allow-other --vfs-cache-mode writes --allow-non-empty

#创建挂载目录

mkdir -p /home/onedrive

#挂载

#如果需要后台保持运行,使用下面的命令

nohup rclone mount remote:path/to/files /home/onedrive &

设置开机自启

#将后面修改成你上面手动运行命令中,除了rclone的全部参数
command="mount DriveName:Folder LocalFolder --cache-dir /tmp --allow-other --vfs-cache-mode writes --allow-non-empty"
#以下是一整条命令,一起复制到SSH客户端运行
cat > /etc/systemd/system/rclone.service <<EOF
[Unit]
Description=Rclone
After=network-online.target

[Service]
Type=simple
ExecStart=$(command -v rclone) ${command}
Restart=on-abort
User=root

[Install]
WantedBy=default.target
EOF

开始启动:

systemctl start rclone

设置开机自启:

systemctl enable rclone

其他命令:

重启:systemctl restart rclone
停止:systemctl stop rclone
状态:systemctl status rclone