#!/usr/bin/perl -w use Quota; use esmith::AccountsDB; my $a = esmith::AccountsDB->open_ro() || die "Couldn't open AccountsDB\n"; print "Login,Prénom,Nom,Espace total (Mo),Espace personnel (Mo),Mail (Mo)\n"; foreach my $user ($a->users){ my $name = $user->key; my $f = $user->prop('FirstName'); my $l = $user->prop('LastName'); my $uid = getpwnam($name); my $dev = Quota::getqcarg('/home/e-smith/files'); my ($size, undef, undef, undef, undef, undef, undef, undef) = Quota::query($dev, $uid); my $home = `du -s -B 1M /home/e-smith/files/users/$name/home | awk {'print \$1}'`; my $mail = `du -s -B 1M /home/e-smith/files/users/$name/Maildir | awk {'print \$1}'`; $size = int($size/1024); chomp($home); chomp($mail); print "$name,$f,$l,$size,$home,$mail\n"; }