![]() |
|< 1 2 3 4 >| | ![]() |
37 entries, 4 pages |
while( my $line = @diff ){
for my $line ( @diff ){
open(INFILE, "/tmp/sizecheck4.tmp");
open(INFILE, '<',"/tmp/sizecheck4.tmp") or die $!;
push @{ $order[-1] },"\t$2\t$1\t$4\t" . "Diff: " . &calcdiff("$1","$4") . "\n";
push @{ $order[-1] },"\t$2\t$1\t$4\t" . "Diff: " . abs( $1 - $4 ) . "\n";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
xtest11 # perl checksize.pl /home 11
xtest11 # ./checksize /home 11
/home/re17830
.Xauthority 159 106 Diff: 53
.sh_history.0 3858 18 Diff: 3840
.sh_history.1 9734 3154 Diff: 6580
.sh_history.2 6679 93 Diff: 6586
chksize 256 0 Diff: 256
scripts 4096 1605 Diff: 2491
/home/root
.bash_history 9359 6653 Diff: 2706
.sh_history.0 16326 15910 Diff: 416
.sh_history.1 8962 1846 Diff: 7116
.sh_history.2 13462 13288 Diff: 174
.sh_history.3 6356 5934 Diff: 422
.vi_history 334 311 Diff: 23
smit.log 83895 43945 Diff: 39950
smit.script 8125 6541 Diff: 1584
smit.transaction 10779 9541 Diff: 1238
/home/root/.ssh
known_hosts 3296 3068 Diff: 228
renee+2008-01-24 08:49:01--betterworld+2008-01-23 22:29:29--
[...] Um mit Datumsangaben zu rechnen:Date::Calc [...]
Habe ich ja auch schon vorgeschlagen ;-)
renee+2008-01-24 13:03:24--Hast Du mal mit zusätzlichen print-Befehlen getestet, *welche* Schleife endlos läuft? Wenn ja, welche Schleife ist es denn?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
xtest11 # time ./checksize.pl /home 11
/home/re17830
.Xauthority 106 159 Diff: 53
.sh_history.0 18 3858 Diff: 3840
.sh_history.1 3154 9734 Diff: 6580
.sh_history.2 93 6679 Diff: 6586
SizeCheck.diff 0 256 Diff: 256
SizeCheck.ksh 1605 4096 Diff: 2491
/home/root
.bash_history 6653 11498 Diff: 4845
.sh_history.0 15910 16326 Diff: 416
.sh_history.1 1846 9036 Diff: 7190
.sh_history.2 13288 13462 Diff: 174
.sh_history.3 5934 6356 Diff: 422
.sh_history.4 3272 3402 Diff: 130
.vi_history 311 333 Diff: 22
smit.log 43945 84044 Diff: 40099
smit.script 6541 8125 Diff: 1584
smit.transaction 9541 10779 Diff: 1238
/home/root/.ssh
known_hosts 3068 3296 Diff: 228
real 3m13.819s
user 2m59.065s
sys 0m0.039s
xtest11 #
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
#!/usr/bin/perl use strict; use Data::Dumper; my $filespath = "/home/re17830/chksize/checksize_db/"; if (defined $ARGV[0]) {} else { print("Error: No argument\n\nUsage: checksize <path> <day>\n"); exit 0; } chomp(my $mountpt = $ARGV[0]); chomp(my $day = $ARGV[1]); chomp(my $month = `date +%m`); chomp(my $premonth = ($month -1)); if ($month == 01) { $premonth = 12; } chomp(my $year = `date +%y`); chomp(my $preyear = ($year - 1)); my $file = "$filespath\SizeCheck-$year\-$month\-$day\.dat"; my $monthfile = "$filespath\SizeCheck-$year\-$premonth\-$day\.dat"; my $yearfile = "$filespath\SizeCheck-$preyear\-$premonth\-$day\.dat"; if (-T "$file") {} else { $file = "$monthfile"; } my @fslist = `ls -Rlgo $mountpt`; my $tmpfile = "/tmp/SizeCheck.tmp"; open(REWRITE, ">$tmpfile"); print REWRITE "$mountpt\:\n"; foreach(@fslist) { chomp(); my @line = split(/ +/); if ($line[0] =~ m/^\//g) { print REWRITE "\n$line[0]\n"; } elsif (($line[0] =~ m/^dr/g) || ($line[0] =~ m/^-r/g)) { print REWRITE "$line[2]\t\t$line[6]\n"; } } my @diff = `sdiff $file $tmpfile \|egrep \[\:\\\<\\\>\\\|\]`; my @order; foreach (@diff ){ if ( $_ =~ m/^(.+):\s+\/.+:$/) { push @order, [$1."\n"]; } elsif ( $_ =~ m/(^\d+)\s+(.+)\s+(.)\s+(\d+)\s+(.+)\s+$/ ) { if ($3 eq "\|") { push @{ $order[-1] },"\t$2\t$1\t$4\t" . "Diff: " . abs($1 - $4) . "\n"; } elsif ($3 eq "\<") { push @{ $order[-1] }, "\tNew File:\t$5\tSize: $4\n"; } elsif ($3 eq "\>") { push @{ $order[-1] },"\tFile deleted:\t$5\n"; } } } for( @order ){ next if @$_ == 1; print $_ for @$_; }
![]() |
|< 1 2 3 4 >| | ![]() |
37 entries, 4 pages |