Here's the script we use to adjust quotas to allow for slow,
controlled growth (maximum 25% expansion per day) without any manual
quota adjustment.

-- 
A new cognitive theory of emotion, http://openheartlogic.org
#!/usr/bin/perl
#
# copy to /etc/cron.daily/

use strict;
use warnings;
use Quota;

use constant HOME => '/home';
use constant MIN_QUOTA => (1024 * 150);

our $dev = Quota::getqcarg(HOME) or die "getqcarg: $!";

sub get_uid { (getpwnam(shift))[2] }

sub adjust {
    my ($user) = @_;
    my $id = get_uid $user;
    my @q = Quota::query($dev, $id);
    my $cur = $q[0];
    $cur = MIN_QUOTA if $cur < MIN_QUOTA;
    Quota::setqlim($dev, $id, $cur * 1.25, $cur * 1.3, 0, 0);
}

opendir my $dh, HOME or die "opendir $!";
while (my $d = readdir $dh) {
    next if ($d =~ /^\./ ||
             $d eq 'demo' ||
             $d eq 'lost+found' ||
             !-d HOME."/$d");
    adjust($d);
}

Attachment: signature.asc
Description: Digital signature

Reply via email to