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

Add verbosity option 2: Include TOUCH and DIFF output in email (only) if no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded). #121

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

DonkeeeyKong
Copy link
Contributor

Description

This adds the option to set VERBOSITY to 2. Setting this will send a mail with the full diff and touch output when the deleted or updated files threshold has been reached or exceeded and no sync was run because of that. It will trim the log in all other cases.
This can be useful if you want to check the list of changed files before running a manual sync every time no automatic sync was run and don't want to bother checking the log via command line.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update (the maintainer will take care of this)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code (only required for new or big features)
  • My changes generate no new warnings

…failed checks)

Send a verbose ("long") email if VERBOSITY is set to 2 and no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded) (i.e. CHK_FAIL is 1 and DO_SYNC is 0).
…failed checks)

Send a verbose ("long") email if VERBOSITY is set to 2 and no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded) (i.e. CHK_FAIL is 1 and DO_SYNC is 0).
…failed checks)

Send a verbose ("long") email if VERBOSITY is set to 2 and no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded) (i.e. CHK_FAIL is 1 and DO_SYNC is 0).
…failed checks)

Send a verbose ("long") email if VERBOSITY is set to 2 and no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded) (i.e. CHK_FAIL is 1 and DO_SYNC is 0).
…failed checks)

Add verbosity option 2: Include TOUCH and DIFF output in email (only) if no sync was run because of failed checks (deleted or updated files threshold has been reached or exceeded).
@auanasgheps
Copy link
Owner

I like the idea to show touch and diff output when thresholds are breached, but the email can get extremely long.

I've thought about it in the past and my conclusions have always leaned towards creating an email attachment of these specific outputs (maybe a file for each output), so the email is still readable. I still haven't looked into this, but I'm sure it's possible and it should not be too much work and we can still use parts of this work.

What do you think?

@DonkeeeyKong
Copy link
Contributor Author

That would be a better option. I have a threshold of 500 files and that was only ever breached by 10 or 20, so the list wasn't too long. This can of course be very different for other situations...

However: I have looked a little bit into it: Adding an attachment is not as easily done as just sending a mail.

mailx can be a variety of programs, that have different ways to attach a file (sometimes it's -a, sometimes its -A, sometimes it's not possible): https://askubuntu.com/questions/1148615/neither-mail-nor-mutt-sends-emails-with-file-attaches

I am using openmediavault and on my system mail/mailx is provided by bsd-mailx, which has no functionality to send attachments: https://manpages.debian.org/bookworm/bsd-mailx/bsd-mailx.1.en.html bsd-mailx is a dependency of openmediavault, so this is the default: https://github.com/openmediavault/openmediavault/blob/3a7d23c61699a33199b4e8edafb8cdf27d2fbe8b/deb/openmediavault/debian/control#L15C1-L15C68

mailutils' mailx on Debian apparently has this functionality: https://manpages.debian.org/bookworm/mailutils/mail.mailutils.1.en.html#A

So this would require to make sure a specific program, e.g. mailutils is used for mail (or setting up (and configuring?) a whole different one like mutt) – and that's only Debian. :D

I am not sure if this doesn't make it too complicated...

@DonkeeeyKong
Copy link
Contributor Author

We could also add another option to have the output send in a separate mail. So people can receive a readable standard email and a separate email with the long output, if they prefer that.

Some characters in the email might not be displayed correctly. Setting the charset of the email to utf-8 solves this.
Some characters in the email might not be displayed correctly. Setting the charset of the email to utf-8 solves this.
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

Successfully merging this pull request may close these issues.

2 participants