安装 FUSE 挂载工具(fclone mount 必须依赖它):
sudo apt update && sudo apt install fuse3 -y
新建一个rclone服务
sudo cat << 'EOF' > /root/rclone.service
[Unit]
Description=rclone
[Service]
User=root
ExecStart=/usr/bin/fclone mount google:{1234} \
/www/wwwroot/p.mqs.hk/Google \
--allow-other \
--allow-non-empty \
--cache-dir /data/fclone-cache \
--attr-timeout 5m \
--vfs-cache-mode full \
--vfs-cache-max-age 24h \
--vfs-cache-max-size 10G \
--vfs-read-chunk-size-limit 100M \
--buffer-size 100M
Restart=on-abort
[Install]
WantedBy=multi-user.target
EOF
把文件复制到自启目录
sudo cp rclone.service /etc/systemd/system/rclone.service
设置文件权限
sudo chmod 644 /etc/systemd/system/rclone.service
重载systemd 配置
sudo systemctl daemon-reload
设置开机自启并立即启动
# 设置开机自启
sudo systemctl enable rclone.service
# 立即启动服务
sudo systemctl start rclone.service
检查服务状态
sudo systemctl status rclone.service