From cb7ff33241638dbb7ac824a2d4a5c93a12dbe544 Mon Sep 17 00:00:00 2001 From: gshapiro Date: Wed, 10 Apr 2002 03:58:40 +0000 Subject: Update mail queue related periodic scripts to account for sendmail 8.12's clientmqueue (submit mail queue). The new mailq display is only active if both the old daily_status_mailq_enable is set to "YES" and the new daily_status_include_submit_mailq is set to "YES" so people who disabled 440.status-mailq won't have any surprises. Likewise, the new queue run is only active if both the old daily_queuerun_enable is set to "YES" and the new daily_submit_queuerun is set to "YES" so people who disabled 500.queuerun won't have any surprises. While I am here, remove the [ ! -d /var/spool/mqueue ] checks from both scripts as the queue directory isn't always /var/spool/mqueue for the main daemon -- it can be set to anything in the sendmail.cf file. MFC after: 1 week --- etc/defaults/periodic.conf | 2 ++ etc/periodic/daily/440.status-mailq | 29 +++++++++++++++++++++++------ etc/periodic/daily/500.queuerun | 12 +++++++----- 3 files changed, 32 insertions(+), 11 deletions(-) (limited to 'etc') diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf index 19c25dc..295a22b 100644 --- a/etc/defaults/periodic.conf +++ b/etc/defaults/periodic.conf @@ -102,6 +102,7 @@ daily_status_rwho_enable="YES" # Check system status # 440.status-mailq daily_status_mailq_enable="YES" # Check mail status daily_status_mailq_shorten="NO" # Shorten output +daily_status_include_submit_mailq="YES" # Also submit queue # 450.status-security daily_status_security_enable="YES" # Security check @@ -117,6 +118,7 @@ daily_status_named_usedns="YES" # DNS lookups are ok # 500.queuerun daily_queuerun_enable="YES" # Run mail queue +daily_submit_queuerun="YES" # Also submit queue # 999.local daily_local="/etc/daily.local" # Local scripts diff --git a/etc/periodic/daily/440.status-mailq b/etc/periodic/daily/440.status-mailq index 17bc710..b75b470 100755 --- a/etc/periodic/daily/440.status-mailq +++ b/etc/periodic/daily/440.status-mailq @@ -18,11 +18,6 @@ case "$daily_status_mailq_enable" in echo '$daily_status_mailq_enable is set but /usr/bin/mailq' \ "isn't executable" rc=2 - elif [ ! -d /var/spool/mqueue ] - then - echo '$daily_status_mailq_enable is set but /var/spool/mqueue' \ - "doesn't exist" - rc=2 else echo "" echo "Mail in local queue:" @@ -39,8 +34,30 @@ case "$daily_status_mailq_enable" in mailq;; esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l) [ $rc -gt 1 ] && rc=1 - fi;; + case "$daily_status_include_submit_mailq" in + [Yy][Ee][Ss]) + if [ -f /etc/mail/submit.cf ] + then + echo "" + echo "Mail in submit queue:" + + rc=$(case "$daily_status_mailq_shorten" in + [Yy][Ee][Ss]) + rc=$(mailq -Ac | + perl -ne 'print if /^\s+\S+@/' | + sort | + uniq -c | + sort -nr | + awk '$1 > 1 {print $1, $2}');; + *) + mailq -Ac;; + esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l) + [ $rc -gt 1 ] && rc=1 + fi;; + esac + fi;; + *) rc=0;; esac diff --git a/etc/periodic/daily/500.queuerun b/etc/periodic/daily/500.queuerun index 2a8b2a1..f46c246 100755 --- a/etc/periodic/daily/500.queuerun +++ b/etc/periodic/daily/500.queuerun @@ -18,13 +18,15 @@ case "$daily_queuerun_enable" in echo '$daily_queuerun_enable is set but /usr/sbin/sendmail' \ "isn't executable" rc=2 - elif [ ! -d /var/spool/mqueue ] - then - echo '$daily_queuerun_enable is set but /var/spool/mqueue' \ - "doesn't exist" - rc=2 else /usr/sbin/sendmail -q >/dev/null 2>&1 & + case "$daily_submit_queuerun" in + [Yy][Ee][Ss]) + if [ -f /etc/mail/submit.cf ] + then + /usr/sbin/sendmail -q -Ac >/dev/null 2>&1 & + fi;; + esac rc=0 fi;; -- cgit v1.1