Fixed minor syntax and logic errors
This commit is contained in:
parent
9fdfaea7fe
commit
4edd340135
10
wipe.pl
10
wipe.pl
@ -134,7 +134,6 @@ sub wipethemdrives {
|
|||||||
print " Checking raid wipe...";
|
print " Checking raid wipe...";
|
||||||
if ($disksum2 eq $clobsum) {
|
if ($disksum2 eq $clobsum) {
|
||||||
say +("."x$spacer)."Checksum $color{green}PASSED$color{reset}";
|
say +("."x$spacer)."Checksum $color{green}PASSED$color{reset}";
|
||||||
return 1;
|
|
||||||
} else {
|
} else {
|
||||||
say +("."x$spacer)."Checksum $color{red}FAILED$color{reset}";
|
say +("."x$spacer)."Checksum $color{red}FAILED$color{reset}";
|
||||||
return 0;
|
return 0;
|
||||||
@ -150,13 +149,14 @@ sub wipethemdrives {
|
|||||||
seek($longdiskw,0,2);
|
seek($longdiskw,0,2);
|
||||||
my $totalBytes = tell($longdiskw);
|
my $totalBytes = tell($longdiskw);
|
||||||
seek($longdiskw,0,0);
|
seek($longdiskw,0,0);
|
||||||
until (eof $longdiskw) {
|
for (0..$totalBytes) {
|
||||||
print $longdiskw "\0";
|
print $longdiskw "\0";
|
||||||
if ( !(tell($lingdiskw) % ($totoalBytes / 1000) ) {
|
if ( !(tell($longdiskw) % ($totalBytes / 1000)) ) {
|
||||||
printf(" %5.5s%%\r\r\r\r\r\r\r", sprintf("%.2f", (tell($longdiskw)/$totalBytes)) );
|
printf(" %5.5s%%\r\r\r\r\r\r\r", sprintf("%.2f", (tell($longdiskw)/$totalBytes)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# to test a drive
|
# to test a drive
|
||||||
@ -165,7 +165,7 @@ sub smartcheck {
|
|||||||
my $diskid = shift;
|
my $diskid = shift;
|
||||||
my $disks = shift;
|
my $disks = shift;
|
||||||
print "Checking overall-health self-assessment test result: ".(" "x19);
|
print "Checking overall-health self-assessment test result: ".(" "x19);
|
||||||
(my $smartassess = `smartctl /dev/sda -H | grep overall`) or (say "$!\ncould not check smart data, skipping" and return 1);
|
(my $smartassess = `smartctl $disks->{$diskid}{path} -H | grep overall`) or (say "\n$!\ncould not check smart data, skipping" and return 1);
|
||||||
$disks->{$diskid}{selftest} = (split(": ", $smartassess))[1];
|
$disks->{$diskid}{selftest} = (split(": ", $smartassess))[1];
|
||||||
if ( "FAILED" eq $disks->{$diskid}{selftest} ) { say "$color{red}Failed$color{reset}"; return 0
|
if ( "FAILED" eq $disks->{$diskid}{selftest} ) { say "$color{red}Failed$color{reset}"; return 0
|
||||||
} else { say "$color{green}Passed$color{reset}"; }
|
} else { say "$color{green}Passed$color{reset}"; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user