440.status-mailq revision 94342
1#!/bin/sh 2# 3# $FreeBSD: head/etc/periodic/daily/440.status-mailq 94342 2002-04-10 03:58:40Z gshapiro $ 4# 5 6# If there is a global system configuration file, suck it in. 7# 8if [ -r /etc/defaults/periodic.conf ] 9then 10 . /etc/defaults/periodic.conf 11 source_periodic_confs 12fi 13 14case "$daily_status_mailq_enable" in 15 [Yy][Ee][Ss]) 16 if [ ! -x /usr/bin/mailq ] 17 then 18 echo '$daily_status_mailq_enable is set but /usr/bin/mailq' \ 19 "isn't executable" 20 rc=2 21 else 22 echo "" 23 echo "Mail in local queue:" 24 25 rc=$(case "$daily_status_mailq_shorten" in 26 [Yy][Ee][Ss]) 27 rc=$(mailq | 28 perl -ne 'print if /^\s+\S+@/' | 29 sort | 30 uniq -c | 31 sort -nr | 32 awk '$1 > 1 {print $1, $2}');; 33 *) 34 mailq;; 35 esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l) 36 [ $rc -gt 1 ] && rc=1 37 38 case "$daily_status_include_submit_mailq" in 39 [Yy][Ee][Ss]) 40 if [ -f /etc/mail/submit.cf ] 41 then 42 echo "" 43 echo "Mail in submit queue:" 44 45 rc=$(case "$daily_status_mailq_shorten" in 46 [Yy][Ee][Ss]) 47 rc=$(mailq -Ac | 48 perl -ne 'print if /^\s+\S+@/' | 49 sort | 50 uniq -c | 51 sort -nr | 52 awk '$1 > 1 {print $1, $2}');; 53 *) 54 mailq -Ac;; 55 esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l) 56 [ $rc -gt 1 ] && rc=1 57 fi;; 58 esac 59 fi;; 60 61 *) rc=0;; 62esac 63 64exit $rc 65