From 9d6f178d2e3c4a68ff3eb6a7c3f33b2c380d784d Mon Sep 17 00:00:00 2001 From: hjp Date: Fri, 8 Oct 2004 10:20:24 +0000 Subject: [PATCH] Fixed parsing of repquota output for Linux. --- quotacheck/quotastat.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/quotacheck/quotastat.pl b/quotacheck/quotastat.pl index 5a08459..7f0abd4 100644 --- a/quotacheck/quotastat.pl +++ b/quotacheck/quotastat.pl @@ -25,20 +25,21 @@ $df =~ s/\n[ \t]+/ /mg; open (STAT, ">>/usr/local/dfstat/quota.stat.$yearmon") or die "cannot append to quota.stat.$yearmon"; for $ln (@df) { ($fs, $total, $used, $free, $pct, $mount) = split(/\s+/, $ln); - if ($fs =~ m|^/dev/| and -f "$mount/quotas") { - open REPQUOTA, "@@@repquota@@@ $mount |" or die "cannot call @@@repquota@@@: $!"; + if ($fs =~ m|^/dev/|) { + open REPQUOTA, "@@@repquota@@@ $mount 2>/dev/null |" or die "cannot call @@@repquota@@@: $!"; while () { $msg = ""; - if (!/\d+/) { + if (!/\b\d+\b/) { #print "header: $_"; } elsif (/(\w+) \s+ [-+][-+] \s* - (\d+)\s+(\d+)\s+(\d+)\s+(|NOT\sSTARTED|EXPIRED|\d+\.\d+\ (?:days|hours))\s+ - (\d+)\s+(\d+)\s+(\d+)\s+(|NOT\sSTARTED|EXPIRED|\d+\.\d+\ (?:days|hours)) + (\d+)\s+(\d+)\s+(\d+)\s+(|NOT\sSTARTED|EXPIRED|\d+(?:\.\d+)?\ ?(?:days|hours))\s+ + (\d+)\s+(\d+)\s+(\d+)\s+(|NOT\sSTARTED|EXPIRED|\d+(?:\.\d+)?\ ?(?:days|hours)) /x) { print STAT "$datetime\t$mount\t$1\t$2\t$3\t$4\t$6\t$7\t$8\n"; } else { print "unparseable: $_"; } } + close(REPQUOTA); } }