From: Sascha Wildner Date: Sun, 19 Oct 2014 11:37:04 +0000 (+0200) Subject: dma(8): Better integration with our periodic scripts. X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/00db07ff9ee195fe00b334303afc45096186e2b2 dma(8): Better integration with our periodic scripts. * Make dma(8) accept the -Ac option when run as 'mailq'. Also make it run as 'hoststat' and 'purgestat' (does nothing in this case). * Adjust the 440.status-mailq daily periodic script to also check for "Mail queue is empty", which is dma(8)'s corresponding text. Note: We really should be suppressing the checking of the submit queue automatically if mailer.conf is set up for dma(8) but I'm not sure yet what's the best way. Reported and tested by Max Herrgard . --- diff --git a/etc/periodic/daily/440.status-mailq b/etc/periodic/daily/440.status-mailq index bc6f142740..e60a0be354 100644 --- a/etc/periodic/daily/440.status-mailq +++ b/etc/periodic/daily/440.status-mailq @@ -1,7 +1,6 @@ #!/bin/sh # # $FreeBSD: src/etc/periodic/daily/440.status-mailq,v 1.11 2006/03/08 17:26:53 matteo Exp $ -# $DragonFly: src/etc/periodic/daily/440.status-mailq,v 1.4 2007/12/29 21:44:44 matthias Exp $ # # If there is a global system configuration file, suck it in. @@ -34,7 +33,7 @@ case "$daily_status_mailq_enable" in *) mailq;; esac | tee /dev/stderr | - egrep -v '(mqueue is empty|Total requests)' | wc -l) + egrep -v '(Mail queue is empty|mqueue is empty|Total requests)' | wc -l) [ $rc -gt 0 ] && rc=1 || rc=0 case "$daily_status_include_submit_mailq" in @@ -55,7 +54,7 @@ case "$daily_status_mailq_enable" in *) mailq -Ac;; esac | tee /dev/stderr | - egrep -v '(mqueue is empty|Total requests)' | wc -l) + egrep -v '(Mail queue is empty|mqueue is empty|Total requests)' | wc -l) [ $rc_submit -gt 0 ] && rc=1 fi;; esac diff --git a/libexec/dma/dma.c b/libexec/dma/dma.c index 96a4bf848a..6b6ef77f4d 100644 --- a/libexec/dma/dma.c +++ b/libexec/dma/dma.c @@ -459,7 +459,7 @@ main(int argc, char **argv) if (strcmp(argv[0], "mailq") == 0) { argv++; argc--; showq = 1; - if (argc != 0) + if (argc != 0 && strcmp(argv[0], "-Ac") != 0) errx(1, "invalid arguments"); goto skipopts; } else if (strcmp(argv[0], "newaliases") == 0) { @@ -469,6 +469,9 @@ main(int argc, char **argv) if (read_aliases() != 0) errx(1, "could not parse aliases file `%s'", config.aliases); exit(0); + } else if (strcmp(argv[0], "hoststat") == 0 || + strcmp(argv[0], "purgestat") == 0) { + exit(0); } opterr = 0;