[vhffs-dev] [svn] commit: r267 - /trunk/vhffs-robots/src/fix_quota.pl |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Author: gradator
Date: Tue Oct 31 05:04:00 2006
New Revision: 267
Log:
ok... working correctly now... could anyone explain why a spent stupidly 2 hours to remember that I forgot to run quotaon on the filesystem before testing this script ? where is the rope ? :/
Modified:
trunk/vhffs-robots/src/fix_quota.pl
Modified: trunk/vhffs-robots/src/fix_quota.pl
==============================================================================
--- trunk/vhffs-robots/src/fix_quota.pl (original)
+++ trunk/vhffs-robots/src/fix_quota.pl Tue Oct 31 05:04:00 2006
@@ -51,6 +51,7 @@
my $users;
my $inodes;
my $cmd;
+my $dev = Quota::getqcarg($vhffs->get_config->get_datadir);
foreach $group ( @{$groups} )
{
@@ -58,10 +59,14 @@
{
$blocks = $group->get_quota * 1024;
$inodes = $group->get_quota * 1126400 / 100;
- if( -x "/usr/sbin/setquota" )
+
+ unless( Quota::setqlim($dev, $group->get_gid, $blocks, $blocks, $inodes, $inodes, 0, 1) )
{
- Quota::setqlim(Quota::getqcarg($vhffs->get_config->get_datadir), $group->get_gid, $blocks, $blocks, $inodes, $inodes, 0, 1);
Vhffs::Robots::vhffs_log( sprintf( "Update quota for group %s set %s" , $group->get_groupname , $group->get_quota ) );
+ }
+ else
+ {
+ printf("Cannot update quota for group %s, reason: %s\n", $group->get_groupname, Quota::strerr);
}
}
}
@@ -74,15 +79,18 @@
{
$blocks = 1024;
$inodes = 1126400 / 100;
- if( -x "/usr/sbin/setquota" )
+
+ unless( Quota::setqlim($dev, $user->get_gid, $blocks, $blocks, $inodes, $inodes, 0, 1) )
{
- Quota::setqlim(Quota::getqcarg($vhffs->get_config->get_datadir), $user->get_gid, $blocks, $blocks, $inodes, $inodes, 0, 1);
Vhffs::Robots::vhffs_log( sprintf( "Update quota for user group %s set 1" , $user->get_username ) );
+ }
+ else
+ {
+ printf("Cannot update quota for group %s, reason: %s\n", $user->get_username, Quota::strerr);
}
}
}
-
Vhffs::Robots::unlock( $vhffs );
exit 0;