What is the problem you are having with rclone?
When launchd launches a shell script, which in turn executes an rclone sync command, for some source directories an exit code of 1 is given and an error (e.g.: failed to open directory "": open /Users/arnaud/Desktop: operation not permitted) is logged.
The script behaves as expected when manually evoked from a local Terminal. The script behaves as expected when providing rsync with a newly created directory instead.
The directories that result in the error include:
- /Users/arnaud/Desktop
- /Users/arnaud/Documents
- /Users/arnaud/Applications
Considering the limited scope of the failure, I suspect this might be a MacOS account/folder protection problem. But have been unable to resolve the problem.
What is your rclone version (output from rclone version
)
rclone v1.53.3
- os/arch: darwin/amd64
- go version: go1.15.5
Which OS you are using and how many bits (eg Windows 7, 64 bit)
MacOS Big Sur 11.1, 64-bit, Intel
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
)
The shell script (sync-to-remote.sh):
#!/bin/sh
rclone sync "/Users/arnaud/Desktop" gdrive:test --log-file=/Users/arnaud/test/logfile.txt --log-level DEBUG
The plist file (com.av.sync-to-remote.plist):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.av.sync-to-remote</string>
<key>ProgramArguments</key>
<array>
<string>/Users/Shared/av-tool-sync-to-remote/sync-to-remote.sh</string>
</array>
<key>RootDirectory</key>
<string>/Users/Shared/av-tool-sync-to-remote</string>
<!-- Tried with and without UserName and GroupName -->
<key>UserName></key>
<string>arnaud</string>
<key>GroupName</key>
<string>wheel</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin</string>
</dict>
<!-- Every minute for test purposes -->
<key>StartInterval</key>
<integer>60</integer>
<key>StandardOutPath</key>
<string>/tmp/sync-to-remote.stdout</string>
<key>StandardErrorPath</key>
<string>/tmp/sync-to-remote.stderr</string>
<key>Nice</key>
<integer>19</integer>
<!-- Tried different types -->
<key>ProcessType</key>
<string>Background</string>
</dict>
</plist>
The rclone config contents with secrets removed.
[gdrive]
type = drive
client_id = [redacted]
client_secret = [redacted]
scope = drive
token = [redacted]
A log from the command with the -vv
flag
2021/01/02 10:34:42 DEBUG : rclone: Version "v1.53.3" starting with parameters ["rclone" "sync" "Users/arnaud/Desktop/" "gdrive:test" "--log-file=/Users/arnaud/test/logfile.txt" "--log-level" "DEBUG"]
2021/01/02 10:34:42 DEBUG : Creating backend with remote "Users/arnaud/Desktop/"
2021/01/02 10:34:42 DEBUG : Using config file from "/Users/arnaud/.config/rclone/rclone.conf"
2021/01/02 10:34:42 DEBUG : fs cache: renaming cache item "Users/arnaud/Desktop/" to be canonical "/Users/arnaud/Desktop"
2021/01/02 10:34:42 DEBUG : Creating backend with remote "gdrive:test"
2021/01/02 10:34:43 ERROR : : failed to open directory "": open /Users/arnaud/Desktop: operation not permitted
2021/01/02 10:34:43 DEBUG : Google drive root 'test': Waiting for checks to finish
2021/01/02 10:34:43 DEBUG : Google drive root 'test': Waiting for transfers to finish
2021/01/02 10:34:43 ERROR : Google drive root 'test': not deleting files as there were IO errors
2021/01/02 10:34:43 ERROR : Google drive root 'test': not deleting directories as there were IO errors
2021/01/02 10:34:43 INFO : There was nothing to transfer
2021/01/02 10:34:43 ERROR : Attempt 1/3 failed with 2 errors and: not deleting files as there were IO errors
2021/01/02 10:34:43 ERROR : : failed to open directory "": open /Users/arnaud/Desktop: operation not permitted
2021/01/02 10:34:44 DEBUG : Google drive root 'test': Waiting for checks to finish
2021/01/02 10:34:44 DEBUG : Google drive root 'test': Waiting for transfers to finish
2021/01/02 10:34:44 ERROR : Google drive root 'test': not deleting files as there were IO errors
2021/01/02 10:34:44 ERROR : Google drive root 'test': not deleting directories as there were IO errors
2021/01/02 10:34:44 INFO : There was nothing to transfer
2021/01/02 10:34:44 ERROR : Attempt 2/3 failed with 2 errors and: not deleting files as there were IO errors
2021/01/02 10:34:44 ERROR : : failed to open directory "": open /Users/arnaud/Desktop: operation not permitted
2021/01/02 10:34:44 DEBUG : Google drive root 'test': Waiting for checks to finish
2021/01/02 10:34:44 DEBUG : Google drive root 'test': Waiting for transfers to finish
2021/01/02 10:34:44 ERROR : Google drive root 'test': not deleting files as there were IO errors
2021/01/02 10:34:44 ERROR : Google drive root 'test': not deleting directories as there were IO errors
2021/01/02 10:34:44 INFO : There was nothing to transfer
2021/01/02 10:34:44 ERROR : Attempt 3/3 failed with 2 errors and: not deleting files as there were IO errors
2021/01/02 10:34:44 INFO :
Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors: 2 (retrying may help)
Elapsed time: 2.5s