changed some outputs to be more readable
This commit is contained in:
parent
c2a8181ce0
commit
aa3686c0d9
9
wipe.pl
9
wipe.pl
@ -66,7 +66,7 @@ sub getdisks {
|
|||||||
return %listhash;
|
return %listhash;
|
||||||
}
|
}
|
||||||
|
|
||||||
# To while a drive
|
# To whip a drive
|
||||||
sub wipethemdrives {
|
sub wipethemdrives {
|
||||||
my $diskid = shift;
|
my $diskid = shift;
|
||||||
my $disks = shift;
|
my $disks = shift;
|
||||||
@ -102,7 +102,7 @@ sub smartcheck {
|
|||||||
my $diskid = shift;
|
my $diskid = shift;
|
||||||
my $disks = shift;
|
my $disks = shift;
|
||||||
print "Checking S.M.A.R.T. variables...\n";
|
print "Checking S.M.A.R.T. variables...\n";
|
||||||
print 'smartctl '.$disks->{$diskid}{"path"}.' -A -f hex,id | grep "^0x"'."\n";
|
# print 'smartctl '.$disks->{$diskid}{"path"}.' -A -f hex,id | grep "^0x"'."\n";
|
||||||
(my $smartcommand = `smartctl $disks->{$diskid}{"path"} -A -f hex,id | grep "^0x"`) or (print $!."\ncould not check smart data, skipping\n" and return 1);
|
(my $smartcommand = `smartctl $disks->{$diskid}{"path"} -A -f hex,id | grep "^0x"`) or (print $!."\ncould not check smart data, skipping\n" and return 1);
|
||||||
for (split("\n",$smartcommand)) {
|
for (split("\n",$smartcommand)) {
|
||||||
my @smartdata = split(/\s+/,$_);
|
my @smartdata = split(/\s+/,$_);
|
||||||
@ -120,7 +120,7 @@ sub smartcheck {
|
|||||||
close( $smartcommand );
|
close( $smartcommand );
|
||||||
for my $smartentry (sort {$a cmp $b} keys %{$disks->{$diskid}{"smart"}}) {
|
for my $smartentry (sort {$a cmp $b} keys %{$disks->{$diskid}{"smart"}}) {
|
||||||
if ($disks->{$diskid}{"smart"}{$smartentry}{"id"} =~ /0x05|0x07|0xc4|0xc5|0xc6|0xc7/) {
|
if ($disks->{$diskid}{"smart"}{$smartentry}{"id"} =~ /0x05|0x07|0xc4|0xc5|0xc6|0xc7/) {
|
||||||
print $disks->{$diskid}{"smart"}{$smartentry}{"id"}." ".$disks->{$diskid}{"smart"}{$smartentry}{"name"}."\t".$disks->{$diskid}{"smart"}{$smartentry}{"raw_value"}."\t";
|
printf("%-6.6s %-20.20s\t%-10.10s\t", $disks->{$diskid}{"smart"}{$smartentry}{"id"}, $disks->{$diskid}{"smart"}{$smartentry}{"name"}, $disks->{$diskid}{"smart"}{$smartentry}{"raw_value"});
|
||||||
if ($disks->{$diskid}{"smart"}{$smartentry}{"raw_value"} =~ /0|0\/0/) {
|
if ($disks->{$diskid}{"smart"}{$smartentry}{"raw_value"} =~ /0|0\/0/) {
|
||||||
print $color{"green"}."Passed".$color{"reset"}."\n";
|
print $color{"green"}."Passed".$color{"reset"}."\n";
|
||||||
} else { print $color{"red"}."Failed".$color{"reset"}."\n"; return 0}
|
} else { print $color{"red"}."Failed".$color{"reset"}."\n"; return 0}
|
||||||
@ -151,7 +151,7 @@ while () {
|
|||||||
$disks{$diskid}{"smartpass"} = smartcheck($diskid,\%disks);
|
$disks{$diskid}{"smartpass"} = smartcheck($diskid,\%disks);
|
||||||
if ($disks{$diskid}{"smartpass"} == 1) {
|
if ($disks{$diskid}{"smartpass"} == 1) {
|
||||||
print "Smart looks good.\n";
|
print "Smart looks good.\n";
|
||||||
push(@good, $disks{$diskid}{"serial"}."\t".$disks{$diskid}{"model"});
|
push(@good, sprintf("%-20.20s\t%-40.40s",$disks{$diskid}{"serial"},$disks{$diskid}{"model"}));
|
||||||
} else { push(@failed, $disks{$diskid}{"serial"}); }
|
} else { push(@failed, $disks{$diskid}{"serial"}); }
|
||||||
} else { push(@failed, $disks{$diskid}{"serial"}); }
|
} else { push(@failed, $disks{$diskid}{"serial"}); }
|
||||||
print "="x80;
|
print "="x80;
|
||||||
@ -159,6 +159,7 @@ while () {
|
|||||||
}
|
}
|
||||||
print "These drives were successfully wiped and passed SMART, they may be put back into production:\n";
|
print "These drives were successfully wiped and passed SMART, they may be put back into production:\n";
|
||||||
print $color{"green"}.join("\n",sort {$a cmp $b} uniq(@good)).$color{"reset"};
|
print $color{"green"}.join("\n",sort {$a cmp $b} uniq(@good)).$color{"reset"};
|
||||||
|
printf "
|
||||||
anykey("\nHit any key to see the list of failed drives. Please also note any drives that do not appear\non ether list. Those should be tried again (if they do not show up after three times assume falure).");
|
anykey("\nHit any key to see the list of failed drives. Please also note any drives that do not appear\non ether list. Those should be tried again (if they do not show up after three times assume falure).");
|
||||||
print "The folowing drives are bad, RMA or shred:\n";
|
print "The folowing drives are bad, RMA or shred:\n";
|
||||||
print join("\n",sort {$a cmp $b} uniq(@failed));
|
print join("\n",sort {$a cmp $b} uniq(@failed));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user