summaryrefslogtreecommitdiffstats
path: root/move
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-10-30 16:05:34 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-10-30 16:05:34 +0000
commitc01090f52218db71959b80870b2e5a5b339d4c8e (patch)
treef0ebde69d05d944c6c58a2bc5411b5166af8988a /move
parent0209ffe548155686fce6f7dceac1d020535b7b9a (diff)
downloaddrakx-c01090f52218db71959b80870b2e5a5b339d4c8e.tar
drakx-c01090f52218db71959b80870b2e5a5b339d4c8e.tar.gz
drakx-c01090f52218db71959b80870b2e5a5b339d4c8e.tar.bz2
drakx-c01090f52218db71959b80870b2e5a5b339d4c8e.tar.xz
drakx-c01090f52218db71959b80870b2e5a5b339d4c8e.zip
scan /var/log/kernel/warnings for nfsd logs (need a patched nfsd)
Diffstat (limited to 'move')
-rwxr-xr-xmove/tools/nfs-accesses51
1 files changed, 51 insertions, 0 deletions
diff --git a/move/tools/nfs-accesses b/move/tools/nfs-accesses
new file mode 100755
index 000000000..812d10815
--- /dev/null
+++ b/move/tools/nfs-accesses
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+use MDK::Common;
+use Getopt::Long;
+
+GetOptions('no-link' => \ (my $no_link), 'no-dir' => \ (my $no_dir), 'full-dirs=s', \ (my $full_dirs));
+
+my @skipped_dirs = (
+ '/usr/share/fonts',
+ '/lib/modules/2.4.22-18mdk',
+ '/usr/X11R6/lib/modules/extensions',
+ '/usr/X11R6/lib/X11/fonts',
+ '/usr/lib/kbd/keymaps',
+ '/usr/share/locale',
+ '/etc/skel',
+ );
+
+my $skipped_dirs = '/tmp/live_tree(' . join('|', map { quotemeta } @skipped_dirs) . ')/';
+if ($full_dirs) {
+ my @l = chomp_(MDK::Common::File::cat_or_die($full_dirs));
+ $full_dirs = '/tmp/live_tree(' . join('|', map { quotemeta } @l) . ')/';
+}
+
+open(my $F, "tac /var/log/kernel/warnings |");
+
+my $wanted_ip;
+
+my @l;
+while (<$F>) {
+ my ($ip, $file) = /kernel: nfsd (.*?): (.*)/ or next;
+
+ if ($wanted_ip) {
+ $wanted_ip eq $ip or next;
+ } else {
+ warn "choosing $ip\n";
+ $wanted_ip = $ip;
+ }
+ $file = join('/', '', reverse split('/', $file));
+
+ last if $file =~ m!/tmp/live_tree/move/(devices|symlinks)!;
+
+ if ($file !~ /^$skipped_dirs/) {
+ if (-l $file ? !$no_link : -d $file ? !$no_dir : 1) {
+ my $s = $full_dirs && $file =~ /^$full_dirs/ ? "/tmp/live_tree$1" : $file;
+ unshift @l, $s;
+ }
+ }
+ last if $file eq '/tmp/live_tree/usr/bin/totem';
+}
+
+print "$_\n" foreach uniq(@l);