Hi,
My boss has asked for a report on everyone’s email quotas and current usage. Is there an easy way to generate that, or do I need to go to each user and see what their quota is?
Thanks,
Gerald
Hi,
My boss has asked for a report on everyone’s email quotas and current usage. Is there an easy way to generate that, or do I need to go to each user and see what their quota is?
Thanks,
Gerald
Never mind. Did it. I set up a script. This one sends emails out by cron everyday.
#!/bin/bash
doveadm -f tab quota get -u *@domain.com | grep STORAGE > usage.txt
sort -k7 -nr usage.txt > usage1.txt
awk '{$2=$3=$4=""; print $0}' usage1.txt > usage2.txt
awk '{ if ($4 >= 90) { print $1 } } ' usage2.txt > over90.txt
awk '{ if (($4 >= 85) && ($4 < 90)) { print $1 } } ' usage2.txt > 80-89.txt
awk '{ if ($4 == 99) { print $1 } } ' usage2.txt > 99.txt
while read p
do
sendmail $p < mail80.txt
# echo "80 $p"
done < 80-89.txt
while read p
do
sendmail $p < mail90.txt
# echo "90 $p"
done < over90.txt
while read p
do
sendmail $p < mail99.txt
# echo "99 $p"
done < 99.txt
echo "Subject: Mailbox Usage" > mailadmin.txt
echo "From: noreply@domain.com" >> mailadmin.txt
echo "Mail Full Reports sent to:" >> mailadmin.txt
cat 99.txt >> mailadmin.txt
echo "" >> mailadmin.txt
echo "Over 90% Reports sent to:" >> mailadmin.txt
cat over90.txt >> mailadmin.txt
echo "" >> mailadmin.txt
echo "Over 85% Reports sent to:" >> mailadmin.txt
cat 80-89.txt >> mailadmin.txt
sendmail itservices@domain.com < mailadmin.txt