CVS cleanups:

Added quotasanitycheck.pl and removed quotasanitycheck.
	Added quotasanitycheck
This commit is contained in:
hjp 1998-09-17 08:32:57 +00:00
parent ee8c47eb35
commit 8134befe68
3 changed files with 120 additions and 12 deletions

View File

@ -1,9 +1,10 @@
include GNUmakevars
all: quotacheck quotastat quotasanitycheck
TARGETS = quotacheck quotastat quotasanitycheck
all: $(TARGETS)
clean:
rm -f quotacheck *.bak
rm -f $(TARGETS) *.bak core foo bar baz *.ps
distclean: clean
rm -f customize

104
quotacheck/configure vendored Executable file
View File

@ -0,0 +1,104 @@
#!/bin/sh
#
echo "#!/bin/sh" > customize
echo "sed \\" > customize
chmod +x customize
################################################################
# find a working perl:
#
for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5
do
if $i -e 'exit ($] < 5.000)'
then
echo $i works
perl="$i"
break
fi
done
if [ -z "$perl" ]
then
could not find a working perl command, sorry.
exit 1
fi
echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize
################################################################
# find a working df:
#
for i in /bin/df /usr/bin/df /usr/sbin/df /usr/local/bin/df
do
a=`$i | awk 'NR == 1 {print $2}'`
if [ "$a" = "kbytes" -o "$a" = "1024-blocks" ]
then
echo $i works
df="$i"
break
fi
a=`$i -k | awk 'NR == 1 {print $2}'`
if [ "$a" = "kbytes" -o "$a" = "1024-blocks" ]
then
echo $i -k works
df="$i -k"
break
fi
done
if [ -z "$df" ]
then
could not find a working df command, sorry.
exit 1
fi
echo " -e 's,@@@df@@@,$df,g' \\" >> customize
################################################################
# find repquota:
# We don't try to check whether the output is useful,
# just check whether we can call it. You may need root
# privileges for this to succeed.
#
for i in /usr/sbin/repquota
do
if $i -a
then
echo $i works
repquota="$i"
break
fi
done
if [ -z "$repquota" ]
then
could not find a working repquota command, sorry.
exit 1
fi
echo " -e 's,@@@repquota@@@,$repquota,g' \\" >> customize
################################################################
# find sendmail:
# We don't try to check whether the mail is actually delivered,
# just if sendmail accepts mail for a local user.
# This may not be a very useful test.
#
user=`whoami`
for i in /usr/sbin/sendmail /usr/lib/sendmail
do
if $i -t -i <<EOF
From: $user
To: $user
Subject: Testmail from configure (please ignore)
Test
EOF
then
echo $i works
sendmail="$i"
break
fi
done
if [ -z "$sendmail" ]
then
could not find a working sendmail command, sorry.
exit 1
fi
echo " -e 's,@@@sendmail@@@,$sendmail,g' \\" >> customize

View File

@ -1,11 +1,11 @@
#!/usr/bin/perl
#!@@@perl@@@
#
# $Id: quotasanitycheck,v 1.1 1998-09-17 07:30:12 hjp Exp $
# $Log: quotasanitycheck,v $
# Revision 1.1 1998-09-17 07:30:12 hjp
# Made messages more user friendly (and less admin friendly).
# allow grace time "NOT STARTED".
# added quotasanitycheck.
# $Id: quotasanitycheck.pl,v 1.1 1998-09-17 08:32:57 hjp Exp $
# $Log: quotasanitycheck.pl,v $
# Revision 1.1 1998-09-17 08:32:57 hjp
# CVS cleanups:
# Added quotasanitycheck.pl and removed quotasanitycheck.
# Added quotasanitycheck
#
#
# check quotas for sanity:
@ -25,9 +25,12 @@ getopts('b:f:F:', \%opts);
print "b=", $opts{'b'}, "f=", $opts{'f'}, "F=", $opts{'F'}, "\n";
$blmin = $opts{'b'};
$flmin = $opts{'f'};
$hostname=`hostname`;
chomp($hostname);
open (DF, "/usr/local/bin/df |") or die "cannot call /usr/local/bin/df: $!";
open (DF, "@@@df@@@ |") or die "cannot call @@@df@@@: $!";
$fs = $/;
undef ($/);
@ -40,7 +43,7 @@ $df =~ s/\n[ \t]+/ /mg;
for $ln (@df) {
($fs, $total, $used, $free, $pct, $mount) = split(/\s+/, $ln);
if ($fs =~ m|^/dev/|) {
open REPQUOTA, "/usr/sbin/repquota $mount 2>/dev/null |" or die "cannot call /usr/sbin/repquota: $!";
open REPQUOTA, "@@@repquota@@@ $mount 2>/dev/null |" or die "cannot call @@@repquota@@@: $!";
while (<REPQUOTA>) {
if (/(\w+) \s+ [-+][-+] \s*
(\d+)\s+(\d+)\s+(\d+)\s+(NOT\sSTARTED|EXPIRED|\d+\.\d+\ (?:days|hours)|)\s+
@ -73,7 +76,7 @@ for $ln (@df) {
}
print " file limit";
print " soft: $flsoft hard $flhard";
print " soft $flsoft hard $flhard";
if ($flsoft >= $flmin) {
print " min_ok";
} else {