Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors posted at end of email. #74

Closed
gderf opened this issue Nov 10, 2023 · 11 comments
Closed

Errors posted at end of email. #74

gderf opened this issue Nov 10, 2023 · 11 comments

Comments

@gderf
Copy link

gderf commented Nov 10, 2023

I've been seeing this and just ignoring it. But since I see no mention of it I thought you should know about it.

At the very end of the emailed message sent on script completion I see the following few lines:

All jobs ended. [Fri Nov 10 09:24:59 EST 2023]
awk: cmd. line:1: BEGIN {exit !( < 0)}
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: BEGIN {exit !( < 0)}
awk: cmd. line:1: ^ syntax error

@auanasgheps auanasgheps added the good first issue Good for newcomers label Nov 11, 2023
@auanasgheps
Copy link
Owner

auanasgheps commented Nov 11, 2023

Hi, looks like it only happens when there's a warning, like the file threshold. If the scripts runs normally without an exception, this error doesn't show up.

I've got to look into it.

@aodtcr
Copy link

aodtcr commented Jan 8, 2024

Hi @auanasgheps,

I rarely have any warning messages, so this is the first time that I am noticing the same message at the end of the email. The same is in the outputted log file.

All jobs ended. [Sun 07 Jan 2024 04:00:46 AM CET]
awk: cmd. line:1: BEGIN {exit !( < 0)}
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: BEGIN {exit !( < 0)}
awk: cmd. line:1: ^ syntax error

As it is at the very end of the email or log file, it seems to me that it is in the two awk lines of the prepare_mail function. However, the script runs fine otherwise, this would only parse the threshold violation messages. Useful, but not essential.

Please let me know if you need any further details. Thank you for an amazing script!

@tehniemer
Copy link
Contributor

What are the values set for $ADD_DEL_THRESHOLD and $ADD_DEL_RATIO in the config?

@gderf
Copy link
Author

gderf commented Jan 8, 2024

I have:

ADD_DEL_THRESHOLD=0

I don't have:

ADD_DEL_RATIO

@tehniemer
Copy link
Contributor

Sorry ADD_DEL_RATIO is calculated in the script, I misremembered where that came from.

This is an odd one, that error is likely from this line, elif awk "BEGIN {exit !($ADD_DEL_THRESHOLD > 0)}";, but I'm not sure why you're getting it. It doesn't show up for me, maybe try reinstalling awk

@aodtcr
Copy link

aodtcr commented Jan 8, 2024

What are the values set for $ADD_DEL_THRESHOLD and $ADD_DEL_RATIO in the config?

I have the standard $ADD_DEL_THRESHOLD of 0 and $DEL_THRESHOLD of 500. Today, the $DEL_THRESHOLD was triggered and this is when I saw the warning. I have since checked deleted files and performed a manual sync, so it should not pop up anymore.

Currently I am running GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0), there is no updated package available for my Ubuntu Server 20.04 LTS. I guess I will have to see about updating the OS anyway.

@auanasgheps
Copy link
Owner

Hi, as I said earlier, this issue happens only when there's a WARNING, which triggers some awk commands.
The way these commands are written cause the errors you see. These are harmless as they are still doing their job.

I had a look at this but could not (yet) figure out how to rewrite them correctly. You'll be updated here once it happens.

@auanasgheps
Copy link
Owner

Finally on my way to fix it!

I will replace all awk commands with bc, it is way more reliable. News to come soon :)

auanasgheps added a commit that referenced this issue Jan 24, 2024
awk was used for for floating-point comparisons, but was producing some errors at the end of the script.
bc is a new dependency, but works perfectly. 
Fixes #74
@auanasgheps
Copy link
Owner

auanasgheps commented Jan 24, 2024

You can test the dev channel if you like to see this issue fixed.
bc is a new dependency that must be installed.
I'm working on a way to auto install dependencies (at least on debian-based/ apt distros

Edit: implemented in dev too

@auanasgheps auanasgheps added wait for feedback bug Something isn't working and removed good first issue Good for newcomers labels Jan 24, 2024
@auanasgheps
Copy link
Owner

Note to myself:
With the latest changes there's a new error at the end of the email when the WARNING Forced sync with deleted files is issued.

/usr/sbin/snapraid.custom/snapraid-aio-script.sh: line 770: [: : integer expression expected

I know how to fix it, writing here for tracking purposes.

auanasgheps added a commit that referenced this issue Feb 15, 2024
Fix error at the end of email with condition "WARNING Forced sync with deleted files"
Finally fixes #74
@auanasgheps
Copy link
Owner

Finally: done!

@auanasgheps auanasgheps removed bug Something isn't working in progress labels Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants