I want an rclone backup task to run every day at 6pm. The cronjob I set up for it is however not working. I browsed the forum and the internet to learn how to work with crontab and managed to run test scripts, so the basics are working. I also gave "cron" permissions and made the sh.file executable with chmod +x. However, as soon as I add my rclone command to the cronjob or a shell script containing the rclone command, nothing executes.
Run the command 'rclone version' and share the full output of the command.
os/version: darwin 12.4 (64 bit)
os/kernel: 21.5.0 (x86_64)
Which cloud storage system are you using? (eg Google Drive)
The command you were trying to run (eg rclone copy /tmp remote:tmp)
This is a the shell-script (Pidof was installed via homebrew):
if pidof -o %PPID -x “Cronjob\ –\ All\ Volumes\ Unencrypted.sh”; then
rclone sync /Volumes/ jhdrive:/Backups/Unencrypted/ --transfers=5 --copy-links --create-empty-src-dirs --filter-from /Users/jan/Library/Mobile\ Documents/com\~apple\~CloudDocs/Rclone/Backups/Filter\ –\ All\ Volumes\ Unencrypted.txt --log-level INFO --log-file /Users/jan/Library/Mobile\ Documents/com\~apple\~CloudDocs/Rclone/Logs/Log\ –\ All\ Volumes\ Unencrypted.log --rc
--- the formatting cron jobs entry, looks a bit strange/confusing, using space character without using enclosing quotes and both slashes, forward and backward?
--- perhaps keep the .sh in the /tmp dir
--- how did you create the cron entry; given that .sh script is to be run as root? https://mkyong.com/linux/linux-how-to-run-cron-job-as-root/
--- use a very simple command
echo test > /tmp/test.txt
--- make sure rclone can find and access the rclone.conf file.
maybe hardcode using --config=/path/to/rclone.conf
Exactly, the test scripts were exactly what you wrote down there (echo test...). And they worked. Even with the .sh in that directory.
Yes, I had sudo in the command, but that wasn't working either, so I removed it. Now it's just the time ***** plus the path to the script.
This is how I run rclone commands on Mac, I put the paths into Terminal first so I am sure they are correct and then implement these paths into the rclone command. When I run the rclone command purely in Terminal, everything works fine. Just in the cronjob scenario, things don't work anymore.
I created it with Mac Terminal with "crontab -e", then pressing "i" and then editing it.
In general I haven't found a working solution here not the forum nor on the web of how automating rclone tasks, like each day at a specific time for example.
I'd be happy for some resources/solutions of alternative ways if there are any.
to expand on @jwink3101 idea,
--- i have a python script that creates commands for rclone, 7zip, fastcopy, VSS.
about the function DoCmd, that runs the commands:
--- captures the stdout/stderr and logs that to text files.
---- if your rclone config file is crypted, need to pass that password to rclone.
that is handled by input