Quick Quota Calculator for Cpanel Users

To get an instant view of the diskspace being used by each Cpanel user account home directory, I created this little script. Thanks to Spiral for some pointers on getting the cleaned account list.

CPUSERS=`/bin/ls -- /var/cpanel/users | /bin/grep -v "\.\|cpanel\|root\|mysql\|nobody"`
for CPUSER in $CPUSERS; do
   CPHOME="$(/bin/grep "${CPUSER}:" /etc/passwd | cut -d':' -f6)"
   NEWACC="`/usr/bin/du -m --summarize $CPHOME`"
   S="`printf \"%03d\" $(echo $NEWACC | awk '{print $1}')`"
   let "TOT=$TOT+$(echo $NEWACC | awk '{print $1}')/1"
echo -e $ACCSUM | sort
echo $TOT

As always, do not test in a production environment!

Tags: ,

No comments yet.

Leave a Reply

Bot test * Time limit is exhausted. Please reload the CAPTCHA.