git: f3c2313c5893 - main - mail/dma: Implement cronjob to flush emails

From: Renato Botelho <garga_at_FreeBSD.org>
Date: Fri, 25 Feb 2022 11:46:34 UTC
The branch main has been updated by garga:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f3c2313c5893bd9d17216ace83e131f0dfa8a660

commit f3c2313c5893bd9d17216ace83e131f0dfa8a660
Author:     Ronald Klop <ronald-lists@klop.ws>
AuthorDate: 2022-02-25 11:42:26 +0000
Commit:     Renato Botelho <garga@FreeBSD.org>
CommitDate: 2022-02-25 11:42:26 +0000

    mail/dma: Implement cronjob to flush emails
    
    Add a new cronjob to flush emails every 30 minutes and change
    pkg-message to let users know about it.
    
    PR:             261532
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 mail/dma/Makefile             | 6 ++++--
 mail/dma/files/dma_cron.in    | 5 +++++
 mail/dma/files/pkg-message.in | 6 ++----
 mail/dma/pkg-plist            | 1 +
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/mail/dma/Makefile b/mail/dma/Makefile
index cb5d91e5942c..9a497a47bb0c 100644
--- a/mail/dma/Makefile
+++ b/mail/dma/Makefile
@@ -28,7 +28,7 @@ CFLAGS+=	-DCONF_PATH='\"${PREFIX}/etc/dma\"' -DDMA_GROUP='\"mail\"' \
 LDFLAGS+=	-L${OPENSSLLIB}
 
 PORTSCOUT=	limit:^[0-9\.]*$$
-SUB_FILES=	pkg-message
+SUB_FILES=	dma_cron pkg-message
 
 BUILD_WRKSRC=	${WRKSRC}/bsd
 INSTALL_WRKSRC=	${WRKSRC}/bsd
@@ -43,11 +43,13 @@ post-patch:
 		${WRKSRC}/bsd/dma-mbox-create/Makefile
 
 post-install:
-	${MKDIR} ${STAGEDIR}${ETCDIR}
+	${MKDIR} ${STAGEDIR}${ETCDIR}/cron.d
 	${MKDIR} ${STAGEDIR}/var/spool/dma
 	${INSTALL_DATA} ${WRKSRC}/dma.conf \
 		${STAGEDIR}${ETCDIR}/dma.conf.sample
 	${INSTALL_DATA} ${WRKSRC}/auth.conf \
 		${STAGEDIR}${ETCDIR}/auth.conf.sample
+	${INSTALL_DATA} ${WRKDIR}/dma_cron \
+		${STAGEDIR}${ETCDIR}/cron.d/dma
 
 .include <bsd.port.mk>
diff --git a/mail/dma/files/dma_cron.in b/mail/dma/files/dma_cron.in
new file mode 100644
index 000000000000..43516fc904d8
--- /dev/null
+++ b/mail/dma/files/dma_cron.in
@@ -0,0 +1,5 @@
+SHELL=/bin/sh
+PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
+
+# See crontab(5) for field format.
+*/30 * * * * root %%PREFIX%%/libexec/dma -q
diff --git a/mail/dma/files/pkg-message.in b/mail/dma/files/pkg-message.in
index fcc59f37b315..56989bd39f2b 100644
--- a/mail/dma/files/pkg-message.in
+++ b/mail/dma/files/pkg-message.in
@@ -33,10 +33,8 @@ shutdown, add the following to rc.conf as well:
 
 dma_flushq_enable="YES"
 
-you can also add a cronjob to do regular mailq flushes using the following
-command:
-
-%%PREFIX%%/libexec/dma -q
+A crontab configuration to flush every 30 minutes was added to
+%%PREFIX%%/etc/cron.d/dma.
 
 And you can disable some sendmail specific daily maintenance routines in your
 /etc/periodic.conf file:
diff --git a/mail/dma/pkg-plist b/mail/dma/pkg-plist
index 2e01fb01bc70..0f3dd105a0c8 100644
--- a/mail/dma/pkg-plist
+++ b/mail/dma/pkg-plist
@@ -1,3 +1,4 @@
+%%ETCDIR%%/cron.d/dma
 @(root,mail,2555) libexec/dma
 @(root,mail,4554) libexec/dma-mbox-create
 @sample(root,mail,0644) etc/dma/dma.conf.sample