อีเมลและการทำงานร่วมกัน

How to check mailbox usage of all accounts in Zimbra mail server

Zimbra_LogoScript สำหรับการตรวจสอบการใช้งาน disk บนระบบ Zimbra mail server ซึ่ง script check mailbox usage นี้จะสามารถรายงานจำนวนเนื้อที่ที่แต่ละ user ใช้งานรวมถึงบอกจำนวน Quota ที่ได้ assign ไว้ และสถานะของแต่ละ user อีกด้วย ซึ่งตัวอย่างผลลัพธ์การทำงานสามารถแสดงได้ดังตัวอย่างด้านล่าง


superadmin@ezymailhosting.com - Disk used: 3MB ||  Quota: 0MB (active account)
superuser@ezymailhosting.com - Disk used: 0MB ||  Quota: 0MB (closed account)
systemmin@ezymailhosting.com - Disk used: 0MB ||  Quota: 0MB (closed account)
username@ezymailhosting.com - Disk used: 1MB ||  Quota: 0MB (active account)
superman@ezymailhosting.com - Disk used: 2MB ||  Quota: 0MB (closed account)
...
virus-quarantines.sdwxti@ezymailhosting.com - Disk used: 5MB ||  Quota: 0MB (active account)
============================== total Mailbox usages ================================
Total disk usages: 12MB

Script สำหรับการตรวจสอบการใช้งาน disk บนระบบ Zimbra mail server


#!/bin/bash

SUM=0
server=`hostname`
/opt/zimbra/bin/zmprov gqu $server|egrep -v "galsync|spam.|ham."|awk {'print $1" "$3" "$2'}|sort|while read line
do
    usage=`echo $line|cut -f2 -d " "`
    quota=`echo $line|cut -f3 -d " "`
    user=`echo $line|cut -f1 -d " "`
    status=`/opt/zimbra/bin/zmprov ga $user | grep  ^zimbraAccountStatus | cut -f2 -d " "`
    echo "$user - Disk used: `expr $usage / 1024 / 1024`MB  || Quota: `expr $quota / 1024 / 1024`MB ($status account)"
    SUM=$((SUM + usage))
    echo "${SUM}" > /tmp/tataldiskusage

done

echo "============================== total Mailbox usages ================================"
SUM=`cat /tmp/tataldiskusage`
echo "Total disk usages: `expr $SUM / 1024 / 1024`MB"
EOF.← กลับไปอ่านบทความอื่น