What is the problem you are having with rclone?
Not necessary a rclone problem just having trouble appending a date timestamp to an rclone log in a script.
What is your rclone version (output from rclone version)
v1.52.3
Which OS you are using and how many bits (eg Windows 7, 64 bit)
debian 8.1
The command you were trying to run (eg rclone copy /tmp remote:tmp)
#!/bin/sh
rclone sync -v --stats=0 --dry-run \
--log-file=/home/user/.mylogs/rclone-'date +"%Y%m%d"'.log \
/source remote:directory
So this is more of a linux question, maybe someone with fresh eyes can see the issue and point me in a direction. Thanks in-advance for any help.
asdffdsa
(jojothehumanmonkey)
August 13, 2020, 9:58pm
2
this works for me
rclone lsd gdrive01: -vv --log-file=./rclone_`date +%Y%m%d_%H%M%S`.log
creates a file named rclone_20200813_175533.log
1 Like
@asdffdsa I've tried that variation in the script and directly from the command line the resulting file is still ... rclone-date +%Y%m%d.log
I think I've isolated the issue. I've been using an apostrophe ' but when i copied your code, it appears to have a backtick `. That seems to be the difference that is making it work. Wow, thank-you!
1 Like
asdffdsa
(jojothehumanmonkey)
August 13, 2020, 10:26pm
5
sure, glad to help.
i am a newbie at linux and made the same mistake you did.
i would imagine, everybody makes that mistake once, never twice
ncw
(Nick Craig-Wood)
August 14, 2020, 1:55pm
6
jump-right-in:
I think I've isolated the issue. I've been using an apostrophe ' but when i copied your code, it appears to have a backtick ``` . That seems to be the difference that is making it work. Wow, thank-you!
Backtick is correct, however there is a more modern and easier to read way to write it namely
--log-file=./rclone_$(date +%Y%m%d_%H%M%S).log
$() is great because you can nest it
parent=$(basename $(dirname $PWD))
See the bash FAQ for more reasons to use it.
It is supported on all shells since about 20 years ago
1 Like
system
(system)
Closed
October 14, 2020, 9:55am
7
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.