start from 0 secotor if first message isn't selftest error
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 24 Nov 2013 21:21:17 +0000 (21:21 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 24 Nov 2013 21:21:17 +0000 (21:21 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@305 191e9f34-6774-4a6d-acfc-7664dacd4a2a

recepies/smart/smart-test-relocate.pl

index a9289cd..859f16a 100755 (executable)
@@ -61,12 +61,12 @@ sub smart_last_error {
                if (/^#\s+1.+Completed: read failure\s+\S+\s+\S+\s+(\d+)/) {
                        write_sector $1;
                        smart_test $1;
-                       return;
+                       return 1;
                }
        }
 }
 
-smart_last_error;
+smart_last_error || smart_test 0;
 
 while ( smart ) {
        warn "sleep $delay s", ( $test_started ? " smart test running..." : "idle" ), "\n";