mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
hddshutdown mit sonderbehandlung für SATA
makegraphs um -d ata ergaenzt MPFire Paket angepasst git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@904 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -20,23 +20,31 @@ if ($debug){print "### Searching for available Disks ###\n";}
|
||||
foreach (@devices){
|
||||
chomp $_;
|
||||
$diskstats = `iostat -d -t $_ | tail -2 | head -1 | awk '{ print \$5","\$6}'`;
|
||||
$status = `hdparm -C /dev/$_ | tail -1 | cut -d: -f2`;
|
||||
|
||||
if ( $_ =~ /^s/ ){$status = `sdparm --command=ready /dev/$_ | tail -1`;}
|
||||
else {$status = `hdparm -C /dev/$_ | tail -1 | cut -d: -f2`;}
|
||||
|
||||
chomp $status;
|
||||
chomp $diskstats;
|
||||
if ($debug){print "Device ".$_." is in status".$status." and has ".$diskstats." write and read Requests.\n";}
|
||||
if ($debug){print "Device ".$_." is in status ".$status." and has ".$diskstats." write and read Requests.\n";}
|
||||
sleep 30;
|
||||
|
||||
$newdiskstats = `iostat -d -t $_ | tail -2 | head -1 | awk '{ print \$5","\$6}'`;
|
||||
chomp $newdiskstats;
|
||||
|
||||
if ($diskstats eq $newdiskstats && $status !=~/standby/){
|
||||
if ($diskstats eq $newdiskstats && $status !~/standby/){
|
||||
if ($debug){print "Device ".$_." is set to standy.\n";}
|
||||
system("/sbin/hdparm -y /dev/$_");
|
||||
if ( $_ =~ /^s/ ){system("sdparm --command=stop /dev/$_");}
|
||||
else {system("/sbin/hdparm -y /dev/$_");}
|
||||
system("touch /tmp/hddshutdown-$_");
|
||||
}
|
||||
else{
|
||||
elsif ($diskstatus{$_} ne "0" ){
|
||||
if ($debug){print "Device ".$_." is active.\n";}
|
||||
if ( -e "/tmp/hddshutdown-$_" ) { system("unlink /tmp/hddshutdown-$_"); }
|
||||
}
|
||||
elsif ( $status =~/standby/ ){
|
||||
if ($debug){print "Device ".$_." is in standby mode.\n";}
|
||||
}
|
||||
}
|
||||
|
||||
# end
|
||||
|
||||
@@ -421,7 +421,7 @@ sub updatehdddata
|
||||
|
||||
if ( -e "$path_smartctl" )
|
||||
{
|
||||
system("$path_smartctl -iHA /dev/$disk > /var/log/smartctl_out_hddtemp-$disk");
|
||||
system("$path_smartctl -iHA -d ata /dev/$disk > /var/log/smartctl_out_hddtemp-$disk");
|
||||
}
|
||||
|
||||
if ( -e "$path_hddtemp" )
|
||||
|
||||
Reference in New Issue
Block a user