----- Original Message -----
From: chaouche yacine <yacinechaou...@yahoo.com>
To: "courier-users@lists.sourceforge.net" <courier-users@lists.sourceforge.net>
Sent: Wednesday, May 25, 2016 10:36 AM
Subject: Re: [courier-users] How to force quota recalculation ?


>root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # ./showquota.single 
>i.aitahmed
>Quota sur la boite aux lettres i.aitahmed
>62.85 Mo /  200.00 Mo ( 31.42% )
>Quota sur les archives
>327.07 Mo /  5120.00 Mo ( 6.38% )
>
>-------------------------------------------------------------------------
>root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # 


this is showquota.single in the hope that it would be useful to anyone.


root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # cat showquota.single

1       mega=$((1024*1024))
2       inbox="${1%@*}"
3       maildir="/var/vmail/domain.tld/$inbox"
4       backup="/var/vmail/backup.domain.tld/$inbox"
5       [ ! -e $maildir ] && echo "Boite email inexistante. Veuillez vérifier 
encore une fois l'orthogrape de $in...@domain.tld" && exit 1
6       function get_quota {
7         mailfolder="$1"

8         # then
9         #   echo "Aucune boite email portant ce nom. Veuillez vérifier 
l'orthographe"
10        #   exit 128
11        # fi
12        maildirsize="$mailfolder/maildirsize" 
13        fields=$(echo $(head -2 $maildirsize))
14        max="${fields%%S*}"
15        cur="$(echo $fields | cut -f2 -d ' ')"
16        ratio=$(echo "scale=2; $cur * 100 / $max" | bc)
17        cur=$(echo "scale=2; $cur / $mega" | bc)
18        max=$(echo "scale=2; $max / $mega" | bc)
19        echo "$cur Mo /  $max Mo ( $ratio% )"
20      }
21      echo Quota sur la boite aux lettres $inbox
22      get_quota "$maildir"
23      echo Quota sur les archives
24      get_quota "$backup"
25      echo 
"-------------------------------------------------------------------------"

root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # 


users of this script should change the maildir variable and comment out lines 4 
and 24 as they are specific to my setup.

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to