[Unit] Description=OneDrive (rclone) # 挂载在当前用户的~目录的OneDrive文件夹内,需要提前创建好~/OneDrive AssertPathIsDirectory=%h/OneDrive 、 # Make sure we have network enabled After=network.target
[Service] Type=simple
# 启用vfs模式,将onedrive挂载给/home/xxx/OneDrive文件夹 ExecStart=/usr/bin/rclone mount onedrive:/ OneDrive --vfs-cache-mode full # 取消挂载 ExecStop=/usr/bin/fusermount -zu %h/OneDrive
# Restart the service whenever rclone exists with non-zero exit code Restart=on-failure RestartSec=15
[Install] # Autostart after reboot WantedBy=default.target