Crontab using rclone with date variable

rclone v1.47.0 on ubuntu linux
the following command does not work work as a crontab entry
30 20 * * * rclone copy /home/bill/tester cloud_72:/bill/rclone/date +%Y%m%d -L

crontab does not report an error after running it
it works if i enter the line (without 30 20 * * *) in a terminal so the command is validly scripted
it works in crontab if i use a fixed destination eg cloud_72:/xyz
it seems the variable part date +%... is not understood by rclone when called from crontab but it is ok when called from the command line
any suggestion
Thanks Bill

hello and welcome to the forum,

that version of rclone is approx 20 months old
you can update here

sorry, not a linux expert, but we have many and one should stop by soon...

in the mean time, have you tried to search the forum, for example
What am I missing in Crontab executing the .cron files? - #12 by Disgrace2029

wow - that was a lightning fast response, really took my breath away, many thanks. unfortunately i'm also not a linux expert but i'll obviously have to learn fast so I'll follow the instructions in the link you gave me.
once again, many thanks

The "`date +%Y...`" part is interpreted by the shell, not by rclone, so what you need to do is get cron to run this through the shell.

What I would do is put your command in a shell script

rclone copy /home/bill/tester cloud_72:/bill/rclone/`date +%Y%m%d` -L

Save that in a file called /home/bill/ Make sure you do chmod a+x /home/bill/ then set your crontab entry to

30 20 * * * /home/bill/

That then definitely runs your command through the shell.

PS Note typing ` is really annoying in markdown!

just tried it and it works perfectly, many thanks it has solved a big problem for me.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.