update fan control

This commit is contained in:
Kovasky Buezo
2024-05-01 14:49:42 -04:00
parent 85d99c3e56
commit 5cd948a2c6

View File

@ -25,10 +25,29 @@ check_temperature() {
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
LOW_TO_HIGH=false
CURRENT_PROFILE="MANUAL" CURRENT_PROFILE="MANUAL"
elif [ "$max_temp" -gt 60 ] && [ "$CURRENT_PROFILE" != "AUTO" ]; then elif [ "$max_temp" -le 65 ] && [ "$CURRENT_PROFILE" != "MANUAL2" ]; then
# enable manual fan control
ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x01 0x00 &> /dev/null
# set initial fan to 30%
ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x02 0xff 0x1e &> /dev/null
# set low_to_high used to determine wait time
if [[ "$CURRENT_PROFILE" == "MANUAL"]]; then
LOW_TO_HIGH=true
else
LOW_TO_HIGH=false
fi
CURRENT_PROFILE="MANUAL2"
elif [ "$max_temp" -gt 65 ] && [ "$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
# set low_to_high used to determine wait time
if [[ "$CURRENT_PROFILE" == "MANUAL2"]]; then
LOW_TO_HIGH=true
else
LOW_TO_HIGH=false
fi
CURRENT_PROFILE="AUTO" CURRENT_PROFILE="AUTO"
fi fi
} }
@ -49,6 +68,7 @@ USER=""
PASS="" PASS=""
VMID="" VMID=""
CURRENT_PROFILE="" CURRENT_PROFILE=""
LOW_TO_HIGH=false
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)
@ -63,8 +83,8 @@ disable_third_party_mode
while true; do while true; do
check_temperature check_temperature
if [[ "$CURRENT_PROFILE" == "AUTO" ]]; then if [[ "$CURRENT_PROFILE" == "AUTO" || "$LOW_TO_HIGH" == true]]; then
sleep 300 sleep 180
else else
sleep 60 sleep 60
fi fi