linux Plesk 17:计算每个域的邮箱使用情况

yvgpqqbh  于 2023-06-29  发布在  Linux
关注(0)|答案(1)|浏览(117)

我试图出口的电子邮件列表,他们的配额是超过80%。我对Plesk脚本很陌生,这就是我现在的情况:

mysql -uadmin -p`cat /etc/psa/.psa.shadow ` psa -NBe"
select m.mail_name, d.name, m.mbox_quota from mail as m 
left join domains as d on m.dom_id=d.id 
where m.mbox_quota <> -1 ;" | 
while read j i k; 
do echo $j"@"$i; 
/usr/local/psa/admin/bin/mailmng-core --get-mailbox-size --domain-name=$i --mailname=$j; 
echo ""/$k;
done

它将输出如下所示的内容:(所有电子邮件没有无限的配额)
email@domain.com
{实际使用量}/{配额}
....
我如何才能做的计算,以出口只有电子邮件帐户,是超过80%和他们的使用百分比?

8ehkhllq

8ehkhllq1#

这可以帮助您:

SELECT 
    concat(mail.mail_name,'@',domains.name) AS 'Email address',
    mn_param.val AS 'Mailbox usage',
    Limits.value AS 'Mailbox limit' 
    FROM mail 
        LEFT JOIN mn_param ON mail.id=mn_param.mn_id 
        LEFT JOIN domains ON mail.dom_id=domains.id 
        LEFT JOIN Subscriptions ON domains.id=Subscriptions.object_id
        LEFT JOIN SubscriptionProperties ON subscriptions.id=SubscriptionProperties.subscription_id 
        LEFT JOIN Limits ON SubscriptionProperties.value=Limits.id 
    WHERE mn_param.param='box_usage' 
        AND Subscriptions.object_type='domain' 
        AND SubscriptionProperties.name='limitsId'
        AND Limits.limit_name='mbox_quota' 
        AND 'box_usage' > 'mbox_quota';

使用最后一行(AND 'box_usage' > 'mbox_quota';)进行自己的比较。

相关问题