
9th August 2007, 10:02
|
|
Junior Member
|
|
Join Date: Sep 2006
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
No Quota information in the mail
Hello,
I have a problem with the mail for the quota When i received mail there's no information in
Quote:
DAILY QUOTA REPORT:
----------------------------------------------
| % UTILISATION | NOM DU COMPTE |
----------------------------------------------
--
|
I look in the post in the forum and modifie this line in /usr/local/sbin/quota_notify
Quote:
close(QF);
next if (! $used);
my $percent = int($used / $quota * 100);
$lusers{$user} = $percent;
|
Added that too :
Quote:
# Added to show if the path to the mailboxes are correct.
# At this point, its showing all the correct path to each mailbox
printf($mboxBase."/".$domain."/".$name."\n");
|
My main.cf
Quote:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
myhostname = xxxxxxx
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#mydestination = localhost.$mydomain
mydestination = mail.xxxxxxx.org, mail.xxxxx.org, localhost, localhost.localdomain
mynetworks = 127.0.0.0/8
mailbox_size_limit = 51200000
maximal_queue_lifetime = 62d
debug_peer_level = 4
maildrop_destination_recipient_limit = 1
################################################## ##########
# UTILISATION MYSQL
################################################## ##########
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = virtual
virtual_mailbox_extended = yes
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
inet_protocols = ipv4
virtual_alias_domains =
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_create_maildirsize = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings
|
and my mysql-virtual_mailbox_limit_maps.cf
Quote:
user = mail_admin
password = password
dbname = mail
query = SELECT quota FROM users WHERE email = '%s'
hosts = 127.0.0.1
|
When i do "sudo /usr/local/sbin/quota_notify"
I look the mysql.log and i don't see requet for the quotas
Anyone have idear ?
Thanks for help
there is juste quotas who don't work
|

12th August 2007, 11:12
|
|
Junior Member
|
|
Join Date: Sep 2006
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Hello Falko,
I change the line but same issue i post my quota_notify
Quote:
my $POSTFIX_CF = "/etc/postfix/main.cf";
my $MAILPROG = "/usr/sbin/sendmail -t";
my $WARNPERCENT = 80;
my @POSTMASTERS = ('postmaster@xxxxx.org');
my $CONAME = 'Server xxxxx';
my $COADDR = 'postmaster@xxxxx.org';
my $SUADDR = 'postmaster@xxxxx.org';
my $MAIL_REPORT = 1;
my $MAIL_WARNING = 1;
#get virtual mailbox base from postfix config
open(PCF, "< $POSTFIX_CF") or die $!;
my $mboxBase;
while (<PCF>) {
next unless /virtual_mailbox_base\s*=\s*(.*)\s*/;
$mboxBase = $1;
}
close(PCF);
#assume one level of subdirectories for domain names
my @domains;
opendir(DIR, $mboxBase) or die $!;
while (defined(my $name = readdir(DIR))) {
next if $name =~ /^\.\.?$/; #skip '.' and '..'
next unless (-d "$mboxBase/$name");
push(@domains, $name);
}
closedir(DIR);
#iterate through domains for username/maildirsize files
my @users;
chdir($mboxBase);
foreach my $domain (@domains) {
opendir(DIR, $domain) or die $!;
while (defined(my $name = readdir(DIR))) {
next if $name =~ /^\.\.?$/; #skip '.' and '..'
next unless (-d "$domain/$name");
push(@users, {"$name\@$domain" => "$mboxBase/$domain/$name"});
# Added to show if the path to the mailboxes are correct.
# At this point, its showing all the correct path to each mailbox
printf($mboxBase."/".$domain."/".$name."\n");
}
}
closedir(DIR);
#get user quotas and percent used
my (%lusers, $report);
foreach my $href (@users) {
foreach my $user (keys %$href) {
my $quotafile = "$href->{$user}/maildirsize";
next unless (-f $quotafile);
open(QF, "< $quotafile") or die $!;
my ($firstln, $quota, $used);
while (<QF>) {
my $line = $_;
if (! $firstln) {
$firstln = 1;
die "Error: corrupt quotafile $quotafile"
unless ($line =~ /^(\d+)S/);
$quota = $1;
last if (! $quota);
next;
}
die "Error: corrupt quotafile $quotafile"
unless ($line =~ /\s*(-?\d+)/);
$used += $1;
}
close(QF);
next if (! $used);
my $percent = int($used / $quota * 100);
$lusers{$user} = $percent;
}
}
#send a report to the postmasters
if ($MAIL_REPORT) {
open(MAIL, "| $MAILPROG");
select(MAIL);
map {print "To: $_\n"} @POSTMASTERS;
print "From: $COADDR\n";
print "Subject: Daily Quota Report.\n";
print "DAILY QUOTA REPORT:\n\n";
print "----------------------------------------------\n";
print "| % UTILISATION | NOM DU COMPTE |\n";
print "----------------------------------------------\n";
foreach my $luser ( sort { $lusers{$b} <=> $lusers{$a} } keys %lusers ) {
printf("| %3d | %32s |\n", $lusers{$luser}, $luser);
print "---------------------------------------------\n";
}
print "\n--\n";
print "$CONAME\n";
close(MAIL);
}
#email a warning to people over quota
if ($MAIL_WARNING) {
foreach my $luser (keys (%lusers)) {
next unless $lusers{$luser} >= $WARNPERCENT; # skip those under quota
open(MAIL, "| $MAILPROG");
select(MAIL);
print "To: $luser\n";
map {print "BCC: $_\n"} @POSTMASTERS;
print "From: $SUADDR\n";
print "Subject: WARNING: Your mailbox is $lusers{$luser}% full.\n";
print "Reply-to: $SUADDR\n";
print "Your mailbox: $luser is $lusers{$luser}% full.\n\n";
print "Once your e-mail box has exceeded your monthly storage quota\n";
print "your monthly billing will be automatically adjusted.\n";
print "Please consider deleting e-mail and emptying your trash folder to clear some space.\n\n";
print "Contact <$SUADDR> for further assistance.\n\n";
print "Thank You.\n\n";
print "--\n";
print "$CONAME\n";
close(MAIL);
}
}
|
But why in the log on mysql, i don't see request for quota ?
|

13th August 2007, 19:09
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,685
Thanks: 1,899
Thanked 2,600 Times in 2,449 Posts
|
|
Which distribution are you using?
|
|
The Following User Says Thank You to falko For This Useful Post:
|
|

14th August 2007, 07:58
|
|
Junior Member
|
|
Join Date: Sep 2006
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
I'm using Ubuntu edgy
|

15th August 2007, 18:28
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,685
Thanks: 1,899
Thanked 2,600 Times in 2,449 Posts
|
|
Please try this:
Code:
ln -sf /bin/bash /bin/sh
|

14th September 2007, 16:16
|
|
Junior Member
|
|
Join Date: Feb 2007
Location: Belgrade
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by falko
Please try this:
Code:
ln -sf /bin/bash /bin/sh
|
hello,
have you noticed if somebody resolved problem with quota with
'home/vmail/domains'
because in /usr/local/sbin/quota_notify it suppose that you have in configuration
/home/vmail/domains/example.com/blabla
but real situation is just
/home/vmail/example.com/blabla
?
because of that, quota_notify can`t work well
|

14th September 2007, 22:54
|
|
Junior Member
|
|
Join Date: Sep 2006
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
i back home and this command change nothing the report quota is empty
|

26th September 2007, 22:07
|
|
Junior Member
|
|
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by sremac
hello,
have you noticed if somebody resolved problem with quota with
'home/vmail/domains'
because in /usr/local/sbin/quota_notify it suppose that you have in configuration
/home/vmail/domains/example.com/blabla
but real situation is just
/home/vmail/example.com/blabla
?
because of that, quota_notify can`t work well 
|
I've notice that to, I have the same problem as descrive above... some one found any issue ???
|

17th January 2008, 23:18
|
|
Junior Member
|
|
Join Date: Jan 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello
change line 95
from: my $percent = int($used / $quota * 100);
to: my $percent = sprintf "%.3f",($used / $quota * 100);
and line 111
from: printf("| %3d | %32s |\n", $lusers{$luser}, $luser);
to: printf("| %.3f | %32s |\n", $lusers{$luser}, $luser);
--
Pinki
Lukasz Rostalski
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 01:57.
|
|
Recent comments
9 hours 32 min ago
10 hours 32 min ago
14 hours 19 min ago
15 hours 33 min ago
19 hours 9 min ago
1 day 2 hours ago
1 day 11 hours ago
1 day 12 hours ago
2 days 3 hours ago
2 days 6 hours ago