我正在运行一个bash脚本,它在一个包含多个文件的目录上执行rclone。然而,bash命令没有完成,而是得到一个重复的警告。下面你会找到我的bash文件
#!/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"输出的错误是:
/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
... 这个警告只是重复了一遍。我的bash脚本在自鸣得意吗?我确认源目录和目标目录存在。此外,我能够用rsync移动文件,但是我只能用rclone得到这个重复的警告。
我最终要做的是记录克隆不同文件大小所需的时间,通过运行bash脚本,用--transfers参数改变并行传输的数量。
任何建议都将不胜感激,谢谢!
发布于 2022-06-14 21:39:14
time关键字运行给定的实用程序并报告运行它所需的时间。
由于您使用time从脚本中调用脚本本身,运行脚本将涉及使用脚本调用time,而脚本又会调用脚本等,直到内存用完为止。
简而言之,您已经成功地创建了一个无限递归脚本。
要解决这个问题,只需删除调用time的整个行,并在调用脚本的命令行或cron调用脚本时使用time。
此外,您还在调用{source}和{target}时使用了rclone。它们可能应该分别读"$source"和"$target"。
https://unix.stackexchange.com/questions/706201
复制相似问题