Skip to content

Commit 2a5a8a0

Browse files
committed
Reduced tests occurence to improve performances
1 parent a8c12a6 commit 2a5a8a0

File tree

2 files changed

+22
-34
lines changed

2 files changed

+22
-34
lines changed

Dell_iDRAC_fan_controller.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ fi
5050
if [[ $SERVER_MODEL =~ .*[RT][[:space:]]?[0-9][4-9]0.* ]]
5151
then
5252
DELL_POWEREDGE_GEN_14_OR_NEWER=true
53+
CPU1_TEMPERATURE_INDEX=2
54+
CPU2_TEMPERATURE_INDEX=4
5355
else
5456
DELL_POWEREDGE_GEN_14_OR_NEWER=false
57+
CPU1_TEMPERATURE_INDEX=1
58+
CPU2_TEMPERATURE_INDEX=2
5559
fi
5660

5761
# Log main informations
@@ -146,15 +150,19 @@ while true; do
146150
fi
147151
fi
148152

149-
# Enable or disable, depending on the user's choice, third-party PCIe card Dell default cooling response
150-
# No comment will be displayed on the change of this parameter since it is not related to the temperature of any device (CPU, GPU, etc...) but only to the settings made by the user when launching this Docker container
151-
if $DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE
153+
# If server model is Gen 14 (*40) or newer
154+
if ! $DELL_POWEREDGE_GEN_14_OR_NEWER
152155
then
153-
disable_third_party_PCIe_card_Dell_default_cooling_response
154-
THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE_STATUS="Disabled"
155-
else
156-
enable_third_party_PCIe_card_Dell_default_cooling_response
157-
THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE_STATUS="Enabled"
156+
# Enable or disable, depending on the user's choice, third-party PCIe card Dell default cooling response
157+
# No comment will be displayed on the change of this parameter since it is not related to the temperature of any device (CPU, GPU, etc...) but only to the settings made by the user when launching this Docker container
158+
if $DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE
159+
then
160+
disable_third_party_PCIe_card_Dell_default_cooling_response
161+
THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE_STATUS="Disabled"
162+
else
163+
enable_third_party_PCIe_card_Dell_default_cooling_response
164+
THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE_STATUS="Enabled"
165+
fi
158166
fi
159167

160168
# Print temperatures, active fan control profile and comment if any change happened during last time interval

functions.sh

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,10 @@ function retrieve_temperatures () {
3838

3939
# Parse CPU data
4040
local CPU_DATA=$(echo "$DATA" | grep "3\." | grep -Po '\d{2}')
41-
if $DELL_POWEREDGE_GEN_14_OR_NEWER
42-
then
43-
# 14 Gen server or newer
44-
CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}')
45-
else
46-
# 13 Gen server or older
47-
CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $1;}')
48-
fi
41+
CPU1_TEMPERATURE=$(echo $CPU_DATA | awk "{print \$$CPU1_TEMPERATURE_INDEX;}")
4942
if $IS_CPU2_TEMPERATURE_SENSOR_PRESENT
5043
then
51-
if $DELL_POWEREDGE_GEN_14_OR_NEWER
52-
then
53-
# 14 Gen server or newer
54-
CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $4;}')
55-
else
56-
# 13 Gen server or older
57-
CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}')
58-
fi
44+
CPU2_TEMPERATURE=$(echo $CPU_DATA | awk "{print \$$CPU2_TEMPERATURE_INDEX;}")
5945
else
6046
CPU2_TEMPERATURE="-"
6147
fi
@@ -72,22 +58,16 @@ function retrieve_temperatures () {
7258
fi
7359
}
7460

61+
# /!\ Use this function only for Gen 13 and older generation servers /!\
7562
function enable_third_party_PCIe_card_Dell_default_cooling_response () {
7663
# We could check the current cooling response before applying but it's not very useful so let's skip the test and apply directly
77-
if ! $DELL_POWEREDGE_GEN_14_OR_NEWER
78-
then
79-
# 13 Gen server or older
80-
ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 > /dev/null
81-
fi
64+
ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 > /dev/null
8265
}
8366

67+
# /!\ Use this function only for Gen 13 and older generation servers /!\
8468
function disable_third_party_PCIe_card_Dell_default_cooling_response () {
8569
# We could check the current cooling response before applying but it's not very useful so let's skip the test and apply directly
86-
if ! $DELL_POWEREDGE_GEN_14_OR_NEWER
87-
then
88-
# 13 Gen server or older
89-
ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00 > /dev/null
90-
fi
70+
ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00 > /dev/null
9171
}
9272

9373
# Returns :

0 commit comments

Comments
 (0)