1997-08-16 17:04:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
1997-08-16 17:04:02 +00:00
|
|
|
#
|
|
|
|
|
2000-06-23 01:18:31 +00:00
|
|
|
# If there is a global system configuration file, suck it in.
|
|
|
|
#
|
|
|
|
if [ -r /etc/defaults/periodic.conf ]
|
|
|
|
then
|
|
|
|
. /etc/defaults/periodic.conf
|
|
|
|
source_periodic_confs
|
1997-08-16 17:04:02 +00:00
|
|
|
fi
|
2000-06-23 01:18:31 +00:00
|
|
|
|
|
|
|
case "$daily_status_mailq_enable" in
|
|
|
|
[Yy][Ee][Ss])
|
2000-09-14 17:19:15 +00:00
|
|
|
if [ ! -x /usr/bin/mailq ]
|
2000-06-23 01:18:31 +00:00
|
|
|
then
|
2000-09-14 17:19:15 +00:00
|
|
|
echo '$daily_status_mailq_enable is set but /usr/bin/mailq' \
|
|
|
|
"isn't executable"
|
|
|
|
rc=2
|
|
|
|
else
|
2000-06-23 01:18:31 +00:00
|
|
|
echo ""
|
|
|
|
echo "Mail in local queue:"
|
|
|
|
|
2000-09-14 17:19:15 +00:00
|
|
|
rc=$(case "$daily_status_mailq_shorten" in
|
2000-06-23 01:18:31 +00:00
|
|
|
[Yy][Ee][Ss])
|
2002-05-07 13:11:05 +00:00
|
|
|
mailq |
|
2002-12-07 23:37:44 +00:00
|
|
|
egrep -e '^[[:space:]]+[^[:space:]]+@' |
|
2000-06-23 01:18:31 +00:00
|
|
|
sort |
|
|
|
|
uniq -c |
|
|
|
|
sort -nr |
|
2002-05-07 13:11:05 +00:00
|
|
|
awk '$1 > 1 {print $1, $2}';;
|
2000-06-23 01:18:31 +00:00
|
|
|
*)
|
|
|
|
mailq;;
|
2000-09-14 17:19:15 +00:00
|
|
|
esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)
|
|
|
|
[ $rc -gt 1 ] && rc=1
|
|
|
|
|
2002-04-10 03:58:40 +00:00
|
|
|
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])
|
2002-05-07 13:11:05 +00:00
|
|
|
mailq -Ac |
|
2002-12-07 23:37:44 +00:00
|
|
|
egrep -e '^[[:space:]]+[^[:space:]]+@' |
|
2002-04-10 03:58:40 +00:00
|
|
|
sort |
|
|
|
|
uniq -c |
|
|
|
|
sort -nr |
|
2002-05-07 13:11:05 +00:00
|
|
|
awk '$1 > 1 {print $1, $2}';;
|
2002-04-10 03:58:40 +00:00
|
|
|
*)
|
|
|
|
mailq -Ac;;
|
|
|
|
esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)
|
|
|
|
[ $rc -gt 1 ] && rc=1
|
|
|
|
fi;;
|
|
|
|
esac
|
|
|
|
fi;;
|
|
|
|
|
2000-09-14 17:19:15 +00:00
|
|
|
*) rc=0;;
|
2000-06-23 01:18:31 +00:00
|
|
|
esac
|
2000-09-14 17:19:15 +00:00
|
|
|
|
|
|
|
exit $rc
|