From e7458fca336d02a082e58deecae492911dc88ccb Mon Sep 17 00:00:00 2001 From: tigerblue77 <37409593+tigerblue77@users.noreply.github.com> Date: Thu, 14 Apr 2022 15:20:09 +0200 Subject: [PATCH] Move the sleep to the beginning of the execution loop to ensure a more regular and punctual execution --- Dell_iDRAC_fan_controller.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dell_iDRAC_fan_controller.sh b/Dell_iDRAC_fan_controller.sh index 86ee073..a18f40c 100644 --- a/Dell_iDRAC_fan_controller.sh +++ b/Dell_iDRAC_fan_controller.sh @@ -55,6 +55,9 @@ IS_DELL_PROFILE_APPLIED=true # Start monitoring while true; do + sleep $CHECK_INTERVAL & + SLEEP_PROCESS_PID=$! + DATA=$(ipmitool -I $LOGIN_STRING sdr type temperature | grep degrees) INLET_TEMPERATURE=$(echo "$DATA" | grep Inlet | grep -Po '\d{2}' | tail -1) EXHAUST_TEMPERATURE=$(echo "$DATA" | grep Exhaust | grep -Po '\d{2}' | tail -1) @@ -109,6 +112,5 @@ while true; do printf "%12s %3d°C %3d°C %3d°C %5d°C %40s %s\n" "$(date +"%d-%m-%y %H:%M:%S")" $INLET_TEMPERATURE $CPU1_TEMPERATURE $CPU2_TEMPERATURE $EXHAUST_TEMPERATURE "$CURRENT_FAN_CONTROL_PROFILE" "$COMMENT" ((i++)) - sleep $CHECK_INTERVAL & - wait $! + wait $SLEEP_PROCESS_PID done