Adding daily mail review from Issue 839#881
Adding daily mail review from Issue 839#881johansmitsnl merged 23 commits intodocker-mailserver:masterfrom akmet:issue-839
Conversation
johansmitsnl
left a comment
There was a problem hiding this comment.
Could you resolve the conflict in the start script an look at these notes?
| test -x /usr/sbin/pflogsumm || exit 0 | ||
| test -x /usr/bin/bsd-mailx || exit 0 | ||
|
|
||
| /usr/sbin/pflogsumm /var/log/mail/mail.log -d yesterday --problems-first | /usr/bin/bsd-mailx -s "Daily Summery for HOSTNAME" DAILY_SUMM_EMAIL |
There was a problem hiding this comment.
Should the variable be: $DAILY_SUMM_EMAIL ?
There was a problem hiding this comment.
I got problems with sed when used $. Removing it fixed the error..
There was a problem hiding this comment.
Even if you encapsulate the variable with "?
There was a problem hiding this comment.
Used the following line and it does not replace the variable:
sed -i -r 's/$HOSTNAME/'$HOSTNAME'/g' /usr/local/bin/postfix-summary
and
sed -i -r 's/$HOSTNAME/'$HOSTNAME'/g' /usr/local/bin/postfix-summary
| function _setup_daily_summery() { | ||
| notify 'task' 'Setting up daily summery' | ||
|
|
||
| DAILY_SUMM_EMAIL=${DAILY_SUMM_EMAIL:="0"} |
There was a problem hiding this comment.
The default should be set at the start of the script.
| sed -i -r 's/HOSTNAME/'$HOSTNAME'/g' /usr/local/bin/dailysummery | ||
| sed -i -r 's/DAILY_SUMM_EMAIL/'$DAILY_SUMM_EMAIL'/g' /usr/local/bin/dailysummery | ||
|
|
||
| echo "/usr/local/bin/dailysummery" > /etc/cron.daily/dailysummery |
There was a problem hiding this comment.
In the daily directory should contain executable scripts?
Just to confirm.
There was a problem hiding this comment.
due to using logrotate this is obsolet
|
It'd be great if you could change |
|
@17Halbe could you assist with the tests? |
|
Hey, what a great idea! |
| amavisd-new \ | ||
| arj \ | ||
| binutils \ | ||
| bsd-mailx \ |
There was a problem hiding this comment.
Isn't sendmail working for this?
There was a problem hiding this comment.
I wasn't able to do so. But maybe it was just my fault.
Could you provide an example on how to use sendmail? Is there something already existing here I could adapt?
There was a problem hiding this comment.
https://github.com/tomav/docker-mailserver/blob/a73692cc9fb98849bb0eac72311f4966ecaaca41/test/tests.bats#L1368
I haven't tried using it, but the tests seem to work if one is using it like this..
I don't like the way sendmail works either. It's different on every system, sometimes a symlink to some other mail service and then there are about a couple different implementations, all with different syntaxes... 🙄
|
@17Halbe Just had a look at manpage |
|
I think that would be overkill. ;) In that case, I think it‘s not worth the effort. |
|
When using in production we have to edit logrotate anyway because if not we are skipping one day as I mentioned above.. |
|
Travis failed cause because the postfix-accounts.cf file keeps removing while the container runs. |
|
Is the file gone or is it empty? |
|
Like both? |
|
I don't know why that is, maybe change de filesystem of docker? Could you also add a test by calling the function and verify the email has been send and it contains the correct subject and to address? |
|
I‘ll take care of the test. Probably today. |
|
Me neither. But I installed Ubuntu next to Windows and started with a fresh master and now it seems to run. |
fixed logrotate config
Issue 839
hope this was the last time we changed the variables names..
|
Good work! |
Release 5.8.0 * Adding daily mail review from Issue 839 (#881) You can enable REPORT_RECIPIENT for REPORT_INTERVAL reports. Default is disabled. * introducing ENABLE_SRS env variable (#906, #852) In v3.2.0 was SRS introduced and enabled by default Now it is disabled by default and can be enabled with the new env variable. * fixed delalias, added additional tests (#909) Fixes to setup where made for deletion and addition.
I added the daily summery email as requested in #839.
I have not added any tests, because I never worked with this kind of tests and does not really know how to make them and what exact test for. Hope someone can help here?
Currently the script analyzes the /var/log/mail/mail.log and I think logrotate will cause a loss in information when it gets executed. One way to solve this problem could be running logrotate every day at midnight (what I am using in production system) and analyze the mail.log.1 which represents the day before.
Another way could be to analyze the combination of mail.log.1 and mail.log but this just doesn't feels right. Any thoughts?