rclone – warning: shell level (1000) too high, resetting to 1

I am running a bash script that performs rclone on a directory with multiple files. However, the bash command does not finish and I get a repeating warning instead. Below you will find my bash file


#!/bin/bash
echo "starting f2f perf tests"

source="/datadrive/0B-2500Files"

target="/mnt/perftest"

cd "${source}"

#ls /datadrive/Empty-Dir-Structure-250K | xargs -n1 -P4 -I% rsync -Pa % /datadrive/Empty-Dir-Structure-250K
rclone sync {source} {target} --transfers 256 --checkers 256 -v --log-file=/tmp/sync.log 

time /home/marcelomo/f2f-small-files-one-vm.sh
echo "rclone is done"

The error that is outputted is:

/bin/bash: warning: shell level (1000) too high, resetting to 1
/bin/bash: warning: shell level (1000) too high, resetting to 1
/bin/bash: warning: shell level (1000) too high, resetting to 1
/bin/bash: warning: shell level (1000) too high, resetting to 1
/bin/bash: warning: shell level (1000) too high, resetting to 1
/bin/bash: warning: shell level (1000) too high, resetting to 1
/bin/bash: warning: shell level (1000) too high, resetting to 1
... 

And this warning just repeats itself. Is my bash script calling itself? I confirm that the source and destination directories exist. In addition, I am able to move files with rsync but I get this repeated warning with rclone only.

What I eventually want to do is record the time it takes to rclone different file sizes, varying the number of parallel transfers with the –transfers argument by running a bash script.

Any advice would be much appreciated, thanks!

Asked By: fabio contreras

||

The time keyword runs the given utility and reports the time it took to run it.

Since you call the script itself, from within the script, with time, running the script will involve calling time with the script, which in turn will call time with the script, etc., until you run out of memory.

In short, you have managed to create an infinitely recursive script.

To fix this, just remove the whole line calling time and just use time when invoking the script from the command line or cron schedule of from wherever you call the script.

Additionally, you have used {source} and {target} in the call to rclone. These should probably read "$source" and "$target" respectively.

Answered By: Kusalananda
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.