Hi
I noticed that the pkgacct script with the --skiphomedir option takes significantly longer to complete since WHM 11.25.x. After a little research I found what is causing the delay. The following code block was added to the pkgacct script in WHM 11.25.x.
/scripts/pkgacct Line 1237
This code snippet is calculating the size of the users home directory. The "du -s /home/$user" command can be very slow to calculate the size of large accounts. It looks like the variable $homesize is only needed to "echo" the size of the home directory. If this is the case I would recommend using a faster method like "quota $user" to get the actual size of the users home directory.Code:if ($skiphomedir) { my $du = qx( du -s $homedir ); my($homesize_kb) = ($du =~ m/^(\d+)/); ## FreeBSD does not have the -b option; performing the calculation manually. my $homesize = $homesize_kb * 1024; print "\nhomesize is: $homesize\n"; }
Example script to calculate the size (MB) of a users homedir. using the quota command:
user_quota=$(quota $user | grep $volume | awk '{print $2}' | sed 's/*//g') | echo "$user: $user_quota $(echo "scale=1 ; ${user_quota}/1024" | bc)"
What do you guys think about this ?
Brgds
Nicolas



LinkBack URL
About LinkBacks
Reply With Quote





