linux 挂载rclone开机启动脚本

①新建一个 rclone.service 文件 (需要自己修改 rclone 挂载名称及挂载目录)


cat << EOF |sudo tee -a /usr/lib/systemd/system/rclone.service 
[Unit]
Description = rclone
 
[Service]
User = root
ExecStart = /usr/bin/fclone mount google:{1kQrBHF4tX6W4-XQ8mzzFsbJQu3dtbLz6} /www/wwwroot/p.mqs.hk/EasyImages2.0/google --allow-other --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

重载 daemon,让新的服务文件生效:


systemctl start rclone

设置开机启动:


systemctl enable rclone

停止、查看状态可以用:


systemctl stop rclone
systemctl status rclone
ps -ef | grep rclone

重启你的 VPS,然后查看一下 rclone 的服务起来没,接着查看一下盘子挂上去没:


systemctl status rclone
df -h

个人笔记记录