From 5cd948a2c698574753755a9e79ebe74e7df1da84 Mon Sep 17 00:00:00 2001 From: Kovasky Buezo Date: Wed, 1 May 2024 14:49:42 -0400 Subject: [PATCH] update fan control --- proxmox/fan_control/fan_control.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/proxmox/fan_control/fan_control.sh b/proxmox/fan_control/fan_control.sh index 0627aff..ded5f3a 100644 --- a/proxmox/fan_control/fan_control.sh +++ b/proxmox/fan_control/fan_control.sh @@ -25,10 +25,29 @@ check_temperature() { ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x01 0x00 &> /dev/null # set initial fan to 20% ipmitool -I lanplus -H "$HOST" -U "$USER" -P "$PASS" raw 0x30 0x30 0x02 0xff 0x14 &> /dev/null + LOW_TO_HIGH=false 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 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" fi } @@ -49,6 +68,7 @@ USER="" PASS="" VMID="" CURRENT_PROFILE="" +LOW_TO_HIGH=false start_time=$(ps -o lstart= -p $(cat /var/run/qemu-server/$VMID.pid)) start_time=$(date -d "$start_time" +%s) @@ -63,8 +83,8 @@ disable_third_party_mode while true; do check_temperature - if [[ "$CURRENT_PROFILE" == "AUTO" ]]; then - sleep 300 + if [[ "$CURRENT_PROFILE" == "AUTO" || "$LOW_TO_HIGH" == true]]; then + sleep 180 else sleep 60 fi