Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl and Quotas

Reply
Thread Tools

Perl and Quotas

 
 
John Call
Guest
Posts: n/a
 
      02-16-2004
I am trying to write a small script that will change quotas for me on a
RedHat box. The following is my program (99% of which comes from the book
Perl for System Administration).
-----------
#!/usr/bin/perl

use Quota;

$filesystem = '/home/users/<username>';
$soft = 5;
$hard = 6;
$isoft = 0;
$ihard = 0;

my($name,$paswd,$uid,$gid,$quota,$comment,$gcos,$d ir,$shell ) =
getpwnam($ARGV[0]);

$dev = Quota::getqcarg($filesystem);

($curblock, $soft, $hard, $curinode, $btimeout, $curinode, $isoft, $ihard,
$itim
eout) = Quota::query($dev, $uid) or die "Unable to query quota for
$uid:$!\n";

Quota::setqlim($dev, $uid, $soft, $hard, $isoft, $ihard, 1) or die "Unable
to set quotas:$!\n";
---------------

Quota::query returns the following error:
Unable to query quota for 2977:No such process

If I REM out the Quota::query line, Quota::setqlim returns the following
error:
Unable to set quotas:No such file or directory

I'm really not sure why this is happening. I checked the errata page for the
book and found no errors for this section. I also check Google groups and
found nothing.

Any help appreciated.

Thanks,

John


 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      02-16-2004

"John Call" <(E-Mail Removed)> wrote:
> I am trying to write a small script that will change quotas for me on a
> RedHat box. The following is my program (99% of which comes from the book
> Perl for System Administration).
> -----------
> #!/usr/bin/perl
>


use strict;
use warnings;

> use Quota;
>
> $filesystem = '/home/users/<username>';


my $filesystem = ...

> $soft = 5;


my $soft = ...

> $hard = 6;


&c.

> $isoft = 0;
> $ihard = 0;
>
> my($name,$paswd,$uid,$gid,$quota,$comment,$gcos,$d ir,$shell ) =
> getpwnam($ARGV[0]);
>
> $dev = Quota::getqcarg($filesystem);
>
> ($curblock, $soft, $hard, $curinode, $btimeout, $curinode, $isoft, $ihard,
> $itim
> eout) = Quota::query($dev, $uid) or die "Unable to query quota for
> $uid:$!\n";
>
> Quota::setqlim($dev, $uid, $soft, $hard, $isoft, $ihard, 1) or die "Unable
> to set quotas:$!\n";
> ---------------
>
> Quota::query returns the following error:
> Unable to query quota for 2977:No such process


This is an example of an Unhelpful Error Message (Not a typewriter!):
No such process is ESRCH, and the Quota docs say that Quota::query
fails with ESRCH if the user has no quota set. cf. Quota::strerr.

Ben

--
The cosmos, at best, is like a rubbish heap scattered at random.
- Heraclitus
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
James Willmore
Guest
Posts: n/a
 
      02-16-2004
On Sun, 15 Feb 2004 23:29:21 -0500, John Call wrote:

<snip>
>
> Quota::query returns the following error:
> Unable to query quota for 2977:No such process
>
> If I REM out the Quota::query line, Quota::setqlim returns the following
> error:
> Unable to set quotas:No such file or directory
>
> I'm really not sure why this is happening. I checked the errata page for the
> book and found no errors for this section. I also check Google groups and
> found nothing.


Are you *using* quotas on your system? With SuSE, you have the option to
use or not use quotas. And, a quick glance at the LPIC preperation book
shows there are a few commands that you can use to check the status of
quotas on your system (quotacheck, quotaon, etc.). Type in 'man -k quota'
for a list of commands to verify the quotas on your system.

In order to solve your Perl issue, you may want to check the system over
first. If you *have* enabled quotas, and they are being enforced, then
I'm not sure what's going on.

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
7:30, Channel 5: The Bionic Dog (Action/Adventure) The Bionic
<Dog gets a hormonal short-circuit and violates the Mann Act
<with an interstate Greyhound bus.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveState Perl and MinGW [was: Perl 5.14 Windows Strawberry Perl 64 bits] Dilbert Perl Misc 0 11-10-2011 02:20 PM
MCDST: XP home does support disk quotas Pincopallino MCDST 12 08-28-2007 03:33 AM
Newsgroup Quotas - What to do to get more bytes? Ray Donzdorf Computer Support 6 02-09-2004 12:34 PM
Disk quotas Bay MCSA 0 09-14-2003 08:02 PM
Re: How to set up quotas in XP for each user? JohnR Computer Support 2 07-04-2003 05:41 PM



Advertisments