Fix spoolsize pour le web
This commit is contained in:
parent
0dbd16bbbd
commit
e63de8a403
|
@ -664,6 +664,7 @@ src/quota-warning.sh -text
|
|||
src/quota_delete -text
|
||||
src/quota_edit -text
|
||||
src/quota_get -text
|
||||
src/quota_get_all -text
|
||||
src/quota_init -text
|
||||
src/rebuild_all_webconf.sh -text
|
||||
src/sendmail -text
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
alterncpanel ALL = NOPASSWD : /usr/bin/quota, /usr/sbin/setquota, /usr/lib/alternc/fixperms.sh, /usr/lib/alternc/mem_add, /usr/lib/alternc/mem_del, /usr/lib/alternc/quota_edit, /usr/lib/alternc/quota_get, /usr/lib/alternc/du.pl, /usr/lib/alternc/update_mails.sh
|
||||
alterncpanel ALL = NOPASSWD : /usr/bin/quota, /usr/sbin/setquota, /usr/lib/alternc/fixperms.sh, /usr/lib/alternc/mem_add, /usr/lib/alternc/mem_del, /usr/lib/alternc/quota_edit, /usr/lib/alternc/quota_get, /usr/lib/alternc/du.pl, /usr/lib/alternc/update_mails.sh, /usr/sbin/repquota
|
||||
vmail ALL = NOPASSWD : /usr/lib/dovecot/deliver
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
# List quotas of all users in 3 columns :
|
||||
# id used quota
|
||||
|
||||
source /etc/alternc/local.sh
|
||||
|
||||
#checking if quotas are installed
|
||||
command -v /usr/sbin/repquota >/dev/null || { echo "Quotas uninstalled"; exit 0; }
|
||||
|
||||
get_quota() {
|
||||
quotadir="$1"
|
||||
if [ "$quotadir" = "/" ] ; then
|
||||
sudo repquota -g -v -n -p "$quotadir" 2>/dev/null || (echo "Error: can't get quota"; exit 1)
|
||||
else
|
||||
sudo repquota -g -v -n -p "$quotadir" 2>/dev/null || get_quota "$(dirname $quotadir)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Some help : this is what we must parse
|
||||
# Block limits File limits
|
||||
#Group used soft hard grace used soft hard grace
|
||||
#----------------------------------------------------------------------
|
||||
#root -- 1612116 0 0 96181 0 0
|
||||
#adm -- 14532 0 0 226 0 0
|
||||
|
||||
get_quota "$ALTERNC_HTML" | egrep "^\#[0-9]+"|while read gid blank bused bsoft bhard bgrace fused fsoft fhard fgrace ; do
|
||||
echo ${gid/\#/} $bused $bhard
|
||||
done
|
||||
|
|
@ -6,12 +6,22 @@ require_once("/usr/share/alternc/panel/class/config_nochk.php");
|
|||
global $db;
|
||||
|
||||
echo "\n---------------------------\n Generating size-cache for web accounts\n\n";
|
||||
$r=mysql_query("SELECT uid,login FROM membres;");
|
||||
while ($c=mysql_fetch_array($r)) {
|
||||
echo $c["login"]; flush();
|
||||
$size=exec("sudo /usr/lib/alternc/du.pl ".ALTERNC_HTML."/".substr($c["login"],0,1)."/".$c["login"]);
|
||||
$db->query("REPLACE INTO size_web SET uid='".$c["uid"]."',size='$size';");
|
||||
echo " done ($size KB) \n"; flush();
|
||||
exec("/usr/lib/alternc/quota_get_all", $list_quota_tmp);
|
||||
$list_quota=array();
|
||||
foreach ($list_quota_tmp as $qt) {
|
||||
$qt = explode(" ", $qt);
|
||||
$list_quota[$qt[0]] = array('used'=>$qt[1], 'quota'=>$qt[2]);
|
||||
}
|
||||
|
||||
if ($db->query("SELECT uid,login FROM membres;")) {
|
||||
$db2 = new DB_system();
|
||||
while ($db->next_record()) {
|
||||
if (isset($list_quota[$db->f('uid')])) {
|
||||
$qu=$list_quota[$db->f('uid')];
|
||||
$db2->query("INSERT OR REPLACE INTO size_web SET uid='".intval($db->f('uid'))."',size='".intval($qu['used'])."';");
|
||||
echo $db->f('login')." (".$qu['used']." B)\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n---------------------------\n Generating size-cache for MySQL databases\n\n";
|
||||
|
|
Loading…
Reference in New Issue