What is the problem you are having with rclone?
---Hello group, I would like to run rclone automatically at shutdown to sync up to Google drive. I am following this document to run a script with systemd: How to Run a Script Before Shutdown Under Systemd
I have a simple script to sync to Google Drive that works fine when I run it, but it does not like systemd. I first had to add the --config flag so it could find rclone.conf. But now I am getting errors from Google Drive. I assume this is because it is setup to run under my user and not systemd, so I am not sure if there is a work around.
Run the command 'rclone version' and share the full output of the command.
rclone v1.68.2
- os/version: ubuntu 24.04 (64 bit)
- os/kernel: 6.8.0-52-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.23.3
- go/linking: static
- go/tags: none
Which cloud storage system are you using? (eg Google Drive)
Google Drive
The command you were trying to run (eg rclone copy /tmp remote:tmp
)
#!/bin/bash
rclone sync -v --create-empty-src-dirs --config /home/barry/.config/rclone/rclo>
Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.
[Google]
type = drive
scope = drive
token = XXX
team_drive =
[OneDrive]
type = onedrive
token = XXX
drive_id = XXX
drive_type = personal
### Double check the config for sensitive info before posting publicly
A log from the command that you were trying to run with the -vv
flag
This is the result of systemctl status showing the Google drive error "ERROR : Google drive root 'Documents': not deleting directories as there were IO errors"
arry@barryubuntu:~$ systemctl status execute-before-shutdown.service
× execute-before-shutdown.service - Execute custom script before system poweroff
Loaded: loaded (/etc/systemd/system/execute-before-shutdown.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sat 2025-02-15 10:58:45 -05; 7s ago
Process: 27777 ExecStart=/usr/lib/systemd/system-shutdown/backup.sh (code=exited, status=3)
Main PID: 27777 (code=exited, status=3)
CPU: 168ms
Feb 15 10:58:45 barryubuntu backup.sh[27778]: ERROR : Google drive root 'Documents': not deleting directories as there were IO errors
Feb 15 10:58:45 barryubuntu backup.sh[27778]: ERROR : Attempt 3/3 failed with 1 errors and: directory not found
Feb 15 10:58:45 barryubuntu backup.sh[27778]: INFO :
Feb 15 10:58:45 barryubuntu backup.sh[27778]: Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Feb 15 10:58:45 barryubuntu backup.sh[27778]: Errors: 1 (retrying may help)
Feb 15 10:58:45 barryubuntu backup.sh[27778]: Elapsed time: 2.0s
Feb 15 10:58:45 barryubuntu backup.sh[27778]: NOTICE: Failed to sync: directory not found
Feb 15 10:58:45 barryubuntu systemd[1]: execute-before-shutdown.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
Feb 15 10:58:45 barryubuntu systemd[1]: execute-before-shutdown.service: Failed with result 'exit-code'.
Feb 15 10:58:45 barryubuntu systemd[1]: Failed to start execute-before-shutdown.service - Execute custom script before system poweroff.