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
|
|
|
|
elif [ ! -d /var/spool/mqueue ]
|
|
|
|
then
|
|
|
|
echo '$daily_status_mailq_enable is set but /var/spool/mqueue' \
|
|
|
|
"doesn't exist"
|
|
|
|
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])
|
2000-09-14 17:19:15 +00:00
|
|
|
rc=$(mailq |
|
2000-06-23 01:18:31 +00:00
|
|
|
perl -ne 'print if /^\s+\S+@/' |
|
|
|
|
sort |
|
|
|
|
uniq -c |
|
|
|
|
sort -nr |
|
2000-09-14 17:19:15 +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
|
2000-06-23 01:18:31 +00:00
|
|
|
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
|