diff --git a/Dell_iDRAC_fan_controller.sh b/Dell_iDRAC_fan_controller.sh index 4a5d357..cec2edd 100644 --- a/Dell_iDRAC_fan_controller.sh +++ b/Dell_iDRAC_fan_controller.sh @@ -20,7 +20,7 @@ then readonly HEXADECIMAL_FAN_SPEED=$FAN_SPEED else readonly DECIMAL_FAN_SPEED=$FAN_SPEED - readonly HEXADECIMAL_FAN_SPEED=$(printf '0x%02x' $FAN_SPEED) + readonly HEXADECIMAL_FAN_SPEED=$(convert_decimal_value_to_hexadecimal $FAN_SPEED) fi # Check if the iDRAC host is set to 'local' or not then set the IDRAC_LOGIN_STRING accordingly diff --git a/Dockerfile b/Dockerfile index d9c2c52..eb648c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,10 +17,10 @@ WORKDIR /app HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "/app/healthcheck.sh" ] # you should override these default values when running. See README.md -#ENV IDRAC_HOST 192.168.1.100 +# ENV IDRAC_HOST 192.168.1.100 ENV IDRAC_HOST local -#ENV IDRAC_USERNAME root -#ENV IDRAC_PASSWORD calvin +# ENV IDRAC_USERNAME root +# ENV IDRAC_PASSWORD calvin ENV FAN_SPEED 5 ENV CPU_TEMPERATURE_THRESHOLD 50 ENV CHECK_INTERVAL 60 diff --git a/functions.sh b/functions.sh index 6acde9d..e8dd2bf 100644 --- a/functions.sh +++ b/functions.sh @@ -14,6 +14,15 @@ function apply_user_fan_control_profile () { CURRENT_FAN_CONTROL_PROFILE="User static fan control profile ($DECIMAL_FAN_SPEED%)" } +# Convert first parameter given ($DECIMAL_NUMBER) to hexadecimal +# Usage : convert_decimal_value_to_hexadecimal $DECIMAL_NUMBER +# Returns : hexadecimal value of DECIMAL_NUMBER +function convert_decimal_value_to_hexadecimal () { + local DECIMAL_NUMBER=$1 + local HEXADECIMAL_NUMBER=$(printf '0x%02x' $DECIMAL_NUMBER) + echo $HEXADECIMAL_NUMBER +} + # Retrieve temperature sensors data using ipmitool # Usage : retrieve_temperatures $IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT $IS_CPU2_TEMPERATURE_SENSOR_PRESENT function retrieve_temperatures () {