--- recepies/smart/smart-test-relocate.pl 2012/01/25 16:53:11 287 +++ recepies/smart/smart-test-relocate.pl 2012/01/25 17:05:33 288 @@ -18,7 +18,9 @@ } sub smart { - open(my $fh, '-|', "smartctl -l selective $drive"); + my $cmd = "smartctl -l selective $drive"; + warn "$cmd\n"; + open(my $fh, '-|', $cmd); while(<$fh>) { chomp; print "# $_\n"; @@ -31,6 +33,7 @@ smart_test $sector; return 1; } elsif ( m/Self_test_in_progress/ ) { + $test_started = 1; return 1; } elsif ( m/Not_testing/ ) { return 1 if $test_started; @@ -41,6 +44,6 @@ } while ( smart ) { - warn "# sleep $delay s\n"; + warn "sleep $delay s", ( $test_started ? " smart test running..." : "idle" ), "\n"; sleep $delay; }