Mini Shell
Direktori : /bin/ |
|
Current File : //bin/fixmailquotas |
#!/usr/bin/perl -w
die "Please enter a domain name.\n" unless $ARGV[0];
sub getuser {
$fname = `grep -l -R $ARGV[0] /var/cpanel/users`;
chomp($fname);
@fline = split (/\//, $fname);
$cpuser = $fline[4];
if (!$cpuser) {
die "Domain is not local to this server.\n";
} else {
return $cpuser;
}
}
sub fixquota {
my $cpuser = shift;
$path = "/home/". $cpuser . "/etc/$ARGV[0]/quota";
open (QUOTA, "+<$path") or die "Can't open quota file: $!\n";
@quota = <QUOTA>;
seek QUOTA,0,0;
foreach (@quota) {
chomp($_);
$qline = $_;
$nqline = $_ . "0\n";
s/$qline/$nqline/g;
print QUOTA;
}
close QUOTA;
}
&fixquota (&getuser($ARGV[0]));
Zerion Mini Shell 1.0