fix some parsing of smart-intercept-spindown broken by new version
New smart-intercept-spindown didn't accept all formats of input coming to it - the status line we were trying to detect broken status of doesn't appear on most devices
This commit is contained in:
parent
f8e4bf0dc8
commit
8ea6df0eb3
2 changed files with 83 additions and 73 deletions
|
|
@ -404,8 +404,8 @@ sub set_fans_servo {
|
||||||
# to tiny spikes of 1 fan unit. FIXME: But should implement long
|
# to tiny spikes of 1 fan unit. FIXME: But should implement long
|
||||||
# term smoothing of +/- 1 fan unit
|
# term smoothing of +/- 1 fan unit
|
||||||
my $demand_has_changed = !defined $lastfan or
|
my $demand_has_changed = !defined $lastfan or
|
||||||
$demand < $lastfan or
|
($demand < $lastfan) or
|
||||||
$demand > $lastfan + $hysteresis;
|
($demand > $lastfan + $hysteresis);
|
||||||
if ($print_stats or
|
if ($print_stats or
|
||||||
$demand_has_changed) {
|
$demand_has_changed) {
|
||||||
if ($demand_has_changed) {
|
if ($demand_has_changed) {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,10 @@ convert_sas() {
|
||||||
device_product=
|
device_product=
|
||||||
data=
|
data=
|
||||||
local exit_code=0
|
local exit_code=0
|
||||||
while read line ; do
|
exit_condition=false
|
||||||
|
{
|
||||||
|
read line || exit_condition=true
|
||||||
|
while ! $exit_condition ; do
|
||||||
case "$read_initial,$read_data,$line" in
|
case "$read_initial,$read_data,$line" in
|
||||||
true,false,*DATA\ SECTION*)
|
true,false,*DATA\ SECTION*)
|
||||||
read_initial=false
|
read_initial=false
|
||||||
|
|
@ -34,14 +37,19 @@ convert_sas() {
|
||||||
echo "$line"
|
echo "$line"
|
||||||
|
|
||||||
read line
|
read line
|
||||||
if [[ "$line" == SMART\ Health\ Status:*OK ]] ; then
|
if [[ "$line" == SMART\ Health\ Status: ]] ; then
|
||||||
|
if [[ "$line" == *OK ]] ; then
|
||||||
exit_code=0
|
exit_code=0
|
||||||
else
|
else
|
||||||
exit_code=8
|
exit_code=8
|
||||||
fi
|
fi
|
||||||
echo "$line"
|
echo "$line"
|
||||||
|
echo
|
||||||
|
read line
|
||||||
|
fi
|
||||||
|
|
||||||
echo "ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE"
|
echo "ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE"
|
||||||
|
continue # reparse the new line
|
||||||
;;
|
;;
|
||||||
true,false,Vendor:*)
|
true,false,Vendor:*)
|
||||||
device_vendor="$( echo "$line" | sed 's/Vendor: *//' )"
|
device_vendor="$( echo "$line" | sed 's/Vendor: *//' )"
|
||||||
|
|
@ -97,7 +105,9 @@ convert_sas() {
|
||||||
$line"
|
$line"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done <<< "$1"
|
read line || exit_condition=true
|
||||||
|
done
|
||||||
|
} <<< "$1"
|
||||||
if [ -n "$data" ] ; then
|
if [ -n "$data" ] ; then
|
||||||
echo
|
echo
|
||||||
echo "=== SAS DATA ==="
|
echo "=== SAS DATA ==="
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue