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
239 stars 37 forks source link

Discord notification not sent upon completion #78

Closed Sirver51 closed 8 months ago

Sirver51 commented 8 months ago

The start notification works, but I get no notifications after that. Looking at the script, it seems like it's because the "all jobs done" part of the script only checks if email and custom hooks are defined, and not Discord, Telegram, or Healthchecks, unlike earlier in the script. Changing the following line from:

  # all jobs done, let's send output to user if configured
  if [ "$EMAIL_ADDRESS" ] || [ -x "$HOOK_NOTIFICATION" ]; then

to:

  # all jobs done, let's send output to user if configured
  if [ "$EMAIL_ADDRESS" ] || [ -x "$HOOK_NOTIFICATION" ] || [ "$HEALTHCHECKS" -eq 1 ] || [ "$TELEGRAM" -eq 1 ] || [ "$DISCORD" -eq 1 ]; then

Seems to fix it. Or at least gives the following notification:

image

I dunno if this is worth a pull request since it's just a one line change, but if this is the expected output and nothing is missing, I can submit one if necessary.

auanasgheps commented 8 months ago

Hi, Thanks for this!

To be honest, I was unable to replicate the issue, during my testing I always got the final notification message. But as it works for you, I will implement it, as it makes the logic stronger.

auanasgheps commented 8 months ago

Done, thanks!

Sirver51 commented 8 months ago

Thanks for adding it! I didn't see that other issue before, which is strange because I did search for it. Should I test with the current dev to get report information? Because the above change only makes the notification work, I don't get a summary or anything.

By the way, I'm surprised you weren't able to replicate it - are you sure you tried it without an email or custom hooks configured? As @jack-mil mentioned in the other thread, without the suggested change the function call is only reachable if email and/or a custom hook is configured. At least, if I've read the code correctly.

auanasgheps commented 8 months ago

I can't remember, but at this point I can say that I might have not used the same conditions, maybe I forgot to turn off emails. By the way let me know if you have issues with the current dev branch.