diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-11-05 10:20:34 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-11-05 10:20:34 +0000 |
commit | 67a2cb1ebbe4374e0ec2b7d2f27c0fca6c015466 (patch) | |
tree | 087fafe2d7fec7571f5cd7c2069c8b0926fc5782 | |
parent | 908be3b29189fa82128edba43063ff83d995c13b (diff) | |
download | drakx-67a2cb1ebbe4374e0ec2b7d2f27c0fca6c015466.tar drakx-67a2cb1ebbe4374e0ec2b7d2f27c0fca6c015466.tar.gz drakx-67a2cb1ebbe4374e0ec2b7d2f27c0fca6c015466.tar.bz2 drakx-67a2cb1ebbe4374e0ec2b7d2f27c0fca6c015466.tar.xz drakx-67a2cb1ebbe4374e0ec2b7d2f27c0fca6c015466.zip |
make it more flexible
-rw-r--r-- | move/tools/busy-files-accesses | 8 | ||||
-rwxr-xr-x | move/tools/nfs-accesses | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/move/tools/busy-files-accesses b/move/tools/busy-files-accesses index 04f37f7f7..241b68405 100644 --- a/move/tools/busy-files-accesses +++ b/move/tools/busy-files-accesses @@ -6,18 +6,24 @@ use Getopt::Long; GetOptions('no-link' => \ (my $no_link), 'no-dir' => \ (my $no_dir), 'full-dirs=s', \ (my $full_dirs), + 'already-have=s', \ (my $already_have), ); if ($full_dirs) { my @l = map { chomp_(MDK::Common::File::cat_or_die($_)) } split(' ', $full_dirs); $full_dirs = '/tmp/live_tree(' . join('|', map { quotemeta } @l) . ')/'; } +if ($already_have) { + my @l = map { chomp_(MDK::Common::File::cat_or_die($_)) } split(' ', $already_have); + $already_have = '(' . join('|', map { quotemeta } @l) . ')'; +} my ($file_list) = @ARGV; foreach my $file (cat_($file_list)) { chomp $file; $file =~ m!/tmp/live_tree! or next; + $already_have && $file =~ /^$already_have$/ and next; if (-l $file ? !$no_link : -d $file ? !$no_dir : 1) { my $s = $full_dirs && $file =~ /^$full_dirs/ ? "/tmp/live_tree$1" : $file; @@ -25,4 +31,4 @@ foreach my $file (cat_($file_list)) { } } -print "$_\n" foreach sort uniq(@l); +print "$_\n" foreach sort(uniq(@l)); diff --git a/move/tools/nfs-accesses b/move/tools/nfs-accesses index 7c648ea8d..f6afe00a4 100755 --- a/move/tools/nfs-accesses +++ b/move/tools/nfs-accesses @@ -3,10 +3,13 @@ use MDK::Common; use Getopt::Long; +my $first_file = '/usr/bin/totem'; + GetOptions('no-link' => \ (my $no_link), 'no-dir' => \ (my $no_dir), 'full-dirs=s', \ (my $full_dirs), 'ip=s' => \ (my $wanted_ip), + 'first-file=s' => \$first_file, ); my @skipped_dirs = ( @@ -29,7 +32,7 @@ open(my $F, "tac /var/log/kernel/warnings |"); my @l; while (<$F>) { - my ($ip, $file) = /kernel: nfsd \((.*?)\): (.*)/ or next; + my ($ip, $rfile) = /kernel: nfsd \((.*?)\): (.*)/ or next; if ($wanted_ip) { $wanted_ip eq $ip or next; @@ -37,7 +40,7 @@ while (<$F>) { warn "choosing $ip\n"; $wanted_ip = $ip; } - $file = join('/', '', reverse split('/', $file)); + my $file = join('/', '', reverse split('/', $rfile)); last if $file =~ m!/tmp/live_tree/move/(devices|symlinks)!; @@ -47,7 +50,7 @@ while (<$F>) { unshift @l, $s; } } - last if $file eq '/tmp/live_tree/usr/bin/totem'; + last if $file eq "/tmp/live_tree$first_file" || $rfile eq $first_file; } -print "$_\n" foreach sort uniq(@l); +print "$_\n" foreach sort(uniq(@l)); |