Introduction
How do I calculate bandwidth usage per email account?
Procedure
Please note that cPanel support cannot assist with troubleshooting, using, or interpreting this command's output.
The following command can be used to calculate the bandwidth usage per email account for a given domain and user where '$user' represents the cPanel user and '$domain' represents the domain in question:
awk -F':' '{print$1}' /home/$user/etc/$domain.tld/shadow|while read address;do printf "%s@$domain.tld: " "$address";grep "pop3.*${address}@$domain.tld" /var/log/maillog*|awk -F'/' '/bytes/{SUM += $NF}END {print SUM/1024/1024/1024" GB"}';done
Example:
[root@server ~]cPs# awk -F':' '{print$1}' /home/cptech/etc/cptech.test/shadow|while read address;do printf "%s@$domain.tld: " "$address";grep "pop3.*${address}@$domain.tld" /var/log/maillog*|awk -F'/' '/bytes/{SUM += $NF}END {print SUM/1024/1024/1024" GB"}';done
test@.tld: 1 GB
[root@server ~]cPs#
Comments
0 comments
Article is closed for comments.