vanos
Aktives Mitglied
Thread Starter
- Dabei seit
- 09.07.2004
- Beiträge
- 110
- Reaktionspunkte
- 0
Ich habe mir einen Local Opendirectory Master erstellt.
Habe dort meine Benutzer mit Kontingenten erstellt.
Als ich mich mit einem Benutzernamen anmeldete, bemerkte ich
dass es die Kontingente nicht im System richtig konfiguriert für den User,
Alle user haben 0 limit. (abfrage mit repquota -a)
Witzigerweise funktioniert es wenn ich den Bnutzer in meiner localen NetInfoDomain erstelle.
Habe dan mit dem Support 65 min. Telefoniert !
Ca. 10 min. erklärt wass mein Problem ist
Ca. 50 min habe ich gegrübel wie mmmm emmmm und schnauf angehört vom Supporter.
Ca. 5 min. wurde mir erklärt dass das ein Bug ist und ich es mit edquota -u erledigen sollte, wass ich auch schon bemerkte.
edquota -u ist für mich nicht geignet, braucht zuviel Zeit.
Ich möchte dies mit einem script erledigen
DIE LÖSUNG FÜR MEIN PROBLEM
Quelle : grace.evergreen.edu
Speichere dies unter /usr/bin/Quota.pl ab
und chmode es so dass es nur Rootrechte lesen schreiben besitzt.
habe das script ein bischien Modifiziert, Filesystem funktioniert noch nicht !
sudo su
für einen User namens blimb
/usr/bin/quota.pl -u blimb -f / -s 0 -h 100 -d 0 -j 0
oder die Gruppe namens blimb
/usr/bin/quota.pl -g blimb -f / -s 0 -h 100 -d 0 -j 0
Achtung ich übernehme keine Verantwortung für dieses Script !
viel spass
vanos
Habe dort meine Benutzer mit Kontingenten erstellt.
Als ich mich mit einem Benutzernamen anmeldete, bemerkte ich
dass es die Kontingente nicht im System richtig konfiguriert für den User,
Alle user haben 0 limit. (abfrage mit repquota -a)
Witzigerweise funktioniert es wenn ich den Bnutzer in meiner localen NetInfoDomain erstelle.
Habe dan mit dem Support 65 min. Telefoniert !
Ca. 10 min. erklärt wass mein Problem ist
Ca. 50 min habe ich gegrübel wie mmmm emmmm und schnauf angehört vom Supporter.
Ca. 5 min. wurde mir erklärt dass das ein Bug ist und ich es mit edquota -u erledigen sollte, wass ich auch schon bemerkte.
edquota -u ist für mich nicht geignet, braucht zuviel Zeit.
Ich möchte dies mit einem script erledigen
DIE LÖSUNG FÜR MEIN PROBLEM
Quelle : grace.evergreen.edu
Speichere dies unter /usr/bin/Quota.pl ab
und chmode es so dass es nur Rootrechte lesen schreiben besitzt.
Code:
#!/usr/bin/perl
$ChangeToMb = 1;
$edquota = "/usr/sbin/edquota"; # edquota path
$autoedq = "/usr/bin/Quota.pl"; # full path for this script
if (($#ARGV eq 0))
{
if ($ARGV[0] eq '-h')
{
PrintUsage();
}
&EdQuota();
}
else
{
&ParseArgs();
&ChangeToMb();
&CallEdquota();
}
sub ChangeToMb
{
if ($ChangeToMb)
{
$opt_s *= 1024;
$opt_h *= 1024;
$opt_d *= 1024;
$opt_j *= 1024;
}
}
sub PrintUsage
{
print("USAGE:\n".
"$0 -h prints this help\n".
"$0 -u <uid> -f <fsystem> -s <bsoftq> -h <bhardq> ".
"-d <isoftq> -j <ihardq>\n".
"$0 -g <gid> -f <fsystem> -s <bsoftq> -h <bhardq> ".
"-d <isoftq> -j <ihardq>\n");
exit;
}
sub ParseArgs{
use Getopt::Std; # for switch processing
# This sets $opt_u to the user id, $opt_f to the filesystem name,
# $opt_s to the soft quota amount and $opt_h to the hard quota
# amount
getopt("u:g:f:s:h:d:j:"); # colon (:) means this flag takes an argument
if (!($opt_u || $opt_g)|| !$opt_f || !$opt_s=~ /[^0-9.]/ || !$opt_h=~ /[^0-9.]/ )
{
PrintUsage();
}
}
sub CallEdquota{
$ENV{"EDITOR"} = $autoedq; #set the EDITOR variable to point to us
if ($opt_u)
{
open(EPROCESS, "|$edquota -u $opt_u") or
die "Unable to start edquota:$!\n";
}
else
{
open(EPROCESS, "|$edquota -g $opt_g") or
die "Unable to start edquota:$!\n";
}
# send the changes line to the second script invocation
print EPROCESS "$opt_f|$opt_s|$opt_h|$opt_d|$opt_j\n";
close(EPROCESS);
}
sub EdQuota {
$tfile = $ARGV[0]; # get the name of edquota's temp file
open(TEMPFILE, $tfile) or
die "Unable to open temp file $tfile:$!\n".
"check -h for help";
# open a scratch file
open(NEWTEMP, ">$tfile.$$") or
die "Unable to open scratch file $tfile.$$:$!\n".
"check -h for help";
chomp($change = <STDIN>);
my($fs, $b_soft, $b_hard, $i_soft, $i_hard) = split(/\|/,$change); # parse the communique
# read in a line from the temp file. If it contains the
# filesystem we wish to modify, change its values. Write the input
# line (possibly changed) to the scratch file.
$line = 0;
while (<TEMPFILE>)
{
#if (/^$fs: \s+/){
if ($done eq 1)
{
if ($line)
{
$done = 0;
s/(soft\s*=\s*)\d+(, hard\s*=\s*)\d+/$1$i_soft$2$i_hard/;
}
}
else
{
if ($line)
{
$done = 1;
s/(soft\s*=\s*)\d+(, hard\s*=\s*)\d+/$1$b_soft$2$b_hard/;
}
}
$line++;
print NEWTEMP;
#}
}
close(TEMPFILE);
close(NEWTEMP);
# overwrite the temp file with our modified scratch file so
# edquota will get the changes
rename("$tfile.$$",$tfile) or die "Unable to rename $tfile.$$ to $tfile:$!\n";
}
sudo su
für einen User namens blimb
/usr/bin/quota.pl -u blimb -f / -s 0 -h 100 -d 0 -j 0
oder die Gruppe namens blimb
/usr/bin/quota.pl -g blimb -f / -s 0 -h 100 -d 0 -j 0
Achtung ich übernehme keine Verantwortung für dieses Script !
viel spass
vanos