auanasgheps / snapraid-aio-script

The definitive all-in-one SnapRAID script on Linux. Diff, sync, scrub are things of the past. Manage SnapRAID and much, much more!
GNU General Public License v3.0
225 stars 36 forks source link

integer expression expected #86

Closed auanasgheps closed 4 months ago

auanasgheps commented 4 months ago

Self reporting an issue from OMV Forum:

./root/Scripts/snapraid-aio-script.sh: line 791: [: : integer expression expected

Dev branch.

auanasgheps commented 4 months ago

Line 791 is part of this, checks if ADD_DELL_RATIO is lower than the threshold, if true produces the extra warning.

    if [ "$DEL_COUNT" -ge  "$DEL_THRESHOLD" ] && [ "$UPDATE_COUNT" -ge "$UP_THRESHOLD" ] && [ "$DO_SYNC" -eq 0 ]; then
      MSG="Multiple violations - Deleted files ($DEL_COUNT) / ($DEL_THRESHOLD) and changed files ($UPDATE_COUNT) / ($UP_THRESHOLD)"
        if [ "$(echo "$ADD_DEL_RATIO < $ADD_DEL_THRESHOLD" | bc -l)" -eq 1 ]; then
          MSG="Multiple violations - Deleted files ($DEL_COUNT) / ($DEL_THRESHOLD), add/delete ratio ($ADD_DEL_RATIO) / ($ADD_DEL_THRESHOLD), and changed files ($UPDATE_COUNT) / ($UP_THRESHOLD)"
        fi

I have tried to replicate the issue, but the script works correctly:

[WARNING] Multiple violations - Deleted files (3) / (2), add/delete ratio (.33) / (0.5), and changed files (6) / (5) (SnapRAID on omv-test)

Please clarify your environment conditions, what are your settings and what the script did show until that point?

Br33ce commented 4 months ago

Thanks for creating the issue for me. I am running OMV 7 - 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 I've attached my settings (renamend to .txt for upload purposes as github does not like .sh) script-config.txt.

I've just run the script but could not reproduce the error. I think(!) it was a too many differences error, but did not create a screenshot. I will monitor it and report back is all I can offer for now (sorry :-/).

Just to explain my setup: I've setup tiered caching with mergerfs so I dont need to run the script very often (hence the higher values for scrub / changed files). I could prob. do with a simpler script but like yours, especially the report just too much :)

auanasgheps commented 4 months ago

You're not using ADD / DELETE Threshold so I don't know how that error is related to you.

I'll keep testing the script but I'm not sure what I'll get. If nothing comes up I'll close this issue but you can always re-open it.

auanasgheps commented 4 months ago

Closing.