Question
How do you calculate bandwidth usage per email account?
Answer
This article provides commands for calculating the bandwidth usage per email account for a given domain and protocol (e.g., imap or pop3).
Note: cPanel support cannot assist with troubleshooting, using, or interpreting this command's output.
- Log in to the server via SSH or WHM's Terminal as the
rootuser - Run the following commands to calculate the usage:
# read -p "cPanel User: " user ; read -p "Domain: " domain ; read -p "Protocol: " protocol ; awk -F':' '{print$1}' /home/$user/etc/$domain/shadow|while read address;do printf "%s@$domain: " "$address";grep "$protocol.*${address}@$domain" /var/log/maillog|awk -F'/' '/bytes/{SUM += $NF}END {printf "%.2f\n", SUM/1024/1024/1024}';done
# read -p "cPanel User: " user ; read -p "Domain: " domain ; read -p "Protocol: " protocol ; awk -F':' '{print$1}' /home/$user/etc/$domain/shadow|while read address;do printf "%s@$domain: " "$address";grep "$protocol.*${address}@$domain" /var/log/maillog|awk -F'/' '/bytes/{SUM += $NF}END {printf "%.2f\n", SUM/1024/1024}';done
Comments
0 comments
Article is closed for comments.