reduce ipmi calls
This commit is contained in:
@ -20,14 +20,16 @@ check_temperature() {
|
|||||||
sorted_temps=($(printf "%s\n" "${temp_arr[@]}" | sort -nr))
|
sorted_temps=($(printf "%s\n" "${temp_arr[@]}" | sort -nr))
|
||||||
max_temp=${sorted_temps[0]}
|
max_temp=${sorted_temps[0]}
|
||||||
|
|
||||||
if [ "$max_temp" -le 60 ]; then
|
if [ "$max_temp" -le 60 ] && [ "$CURRENT_PROFILE" != "MANUAL" ]; then
|
||||||
# enable manual fan control
|
# enable manual fan control
|
||||||
ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x01 0x00 &> /dev/null
|
ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x01 0x00 &> /dev/null
|
||||||
# set initial fan to 20%
|
# set initial fan to 20%
|
||||||
ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x02 0xff 0x14 &> /dev/null
|
ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x02 0xff 0x14 &> /dev/null
|
||||||
else
|
CURRENT_PROFILE="MANUAL"
|
||||||
|
elif [ "$max_temp" -gt 60 ] && [ "$CURRENT_PROFILE" != "AUTO" ]; then
|
||||||
# enable Dell fan control
|
# enable Dell fan control
|
||||||
ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x01 0x01 &> /dev/null
|
ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x01 0x01 &> /dev/null
|
||||||
|
CURRENT_PROFILE="AUTO"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +48,7 @@ HOST=""
|
|||||||
USER=""
|
USER=""
|
||||||
PASS=""
|
PASS=""
|
||||||
VMID=""
|
VMID=""
|
||||||
|
CURRENT_PROFILE=""
|
||||||
|
|
||||||
start_time=$(ps -o lstart= -p $(cat /var/run/qemu-server/$VMID.pid))
|
start_time=$(ps -o lstart= -p $(cat /var/run/qemu-server/$VMID.pid))
|
||||||
start_time=$(date -d "$start_time" +%s)
|
start_time=$(date -d "$start_time" +%s)
|
||||||
@ -59,5 +62,10 @@ disable_third_party_mode
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
check_temperature
|
check_temperature
|
||||||
|
|
||||||
|
if [[ "$CURRENT_PROFILE" == "AUTO" ]]; then
|
||||||
|
sleep 300
|
||||||
|
else
|
||||||
sleep 60
|
sleep 60
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user