Rclone log to tee command inside script

i want to tee rclone log so i have log in different files, but when it is executed in script i think that the tee command doesnt work well, because the log is buffered.

any option to not buffer log or to make tee command work?

What's the actual command you are running?

This is what I use in my upload cron job, and doesn't look like it is being buffered:

/usr/bin/rclone move /local_path gremote: --min-age 10m -c --transfers 3 --checkers 3 --tpslimit 3 --no-traverse --delete-after --drive-chunk-size 32M --delete-empty-src-dirs 2>&1 | tee -a $LOGFILE

What's the full command?

rclone move "$FROM" "$TO" -v --transfers=20 --checkers=20 -L --min-age 15m --delete-empty-src-dirs -v --stats 5s |tee -a logfile

i will try with 2>&1 perhaps is something from the output??? i dont know why but logfile isnt being updated while i see the log in the script output

You can remove the | tee -a logfile and just use:

--log-file logfile

in that case i dont see double log i must go rclone move & tail logfile

I'm not sure what you mean.

Is your goal to write a logfile?

write a logfile of ALL things uploaded and another for just the current session so two logfiles. before and after i make things i >> to a session logfile

Are you running one command or two commands?

I use a simple upload script and write it out to a logfile:

/usr/bin/rclone move /data/local/ gcrypt: --log-file /opt/rclone/logs/upload.log -v --drive-chunk-size 32M --exclude-from /opt/rclone/scripts/excludes --delete-empty-src-dir

Not quite sure I'm following the before and after.

filebot stuff prior
rclone move second
date log third

all to one file

and just rclone move log to another it would be nice with just rclone log but i wanted both .... and i dont why the tee doesnt work well i think it is because it is using buffered log, but dont know how to fix it

So use the same logfile name for each and you should be good. I personally wouldn't use tee as you can already go directly to a logfile with rclone so why add another command in the mix?

You can simply do this if you want a log and screen output:

Rclone command 2>&1 | tee (-a) /some/log

Can you test that command inside script?

I run it in a script. Inside a screen session.

it is just the move command that writes to stderr instead of stdout. with 2>&1 the tee command works.

Thank you calisro