[EMAIL PROTECTED] wrote:
To Corey:  Thanks for the URL.  It does look promising although not so
easy to see how to use it to quicly extract a temperature.

Try something like this. I'm not good at perl yet (hence my being on this list), but it works for me.

------------------------------------------------------------------------
#!/usr/bin/perl

use strict;
use warnings;

my @discs = ("hda", "sda", "sdb", "sdc", "sdd");

for my $disc (@discs) {
  my @output = split(/\n/, `smartctl -d ata -A /dev/$disc`);
  for (@output) {
    if (/Temperature_Celsius/) {
      my @fields = split(/\s+/);
      print "$disc: ", $fields[9], "\n";
    }
  }
}
------------------------------------------------------------------------

bugfood:/tmp# ./temp.pl
hda: 36
sda: 33
sdb: 37
sdc: 30
sdd: 35


-Corey

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to