From 82d94b6733a14f04dd22b90e8ca03a82d651a994 Mon Sep 17 00:00:00 2001 From: tigerblue77 <37409593+tigerblue77@users.noreply.github.com> Date: Mon, 11 Apr 2022 19:01:44 +0200 Subject: [PATCH] Local iDRAC management --- Dockerfile | 9 +++++---- check-temp.sh | 17 +++++++++++++---- startup.sh | 9 +++++++-- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index d98f36a..8db2d07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,8 +21,9 @@ RUN chmod 0777 /startup.sh RUN /usr/bin/crontab /etc/cron.d/fan-control # you should override these when running. See README.md -ENV IDRAC_HOST 192.168.1.100 -ENV IDRAC_USER root -ENV IDRAC_PW calvin +#ENV IDRAC_HOST 192.168.1.100 +ENV IDRAC_HOST local +#ENV IDRAC_USER root +#ENV IDRAC_PW calvin ENV FANSPEED 0x05 -CMD /startup.sh && cron && tail -f /var/log/cron.log \ No newline at end of file +CMD /startup.sh && cron && tail -f /var/log/cron.log diff --git a/check-temp.sh b/check-temp.sh index 6a5babf..4dde47d 100755 --- a/check-temp.sh +++ b/check-temp.sh @@ -1,3 +1,5 @@ +#!/bin/bash + IPMIHOST=`cat /host.txt` IPMIUSER=`cat /user.txt` IPMIPW=`cat /pw.txt` @@ -5,15 +7,22 @@ FANSPEED=`cat /fanspeed.txt` MAXTEMP=32 -TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature |grep Inlet |grep degrees |grep -Po '\d{2}' | tail -1) +if [[ $IPMIHOST == "local" ]] +then + LOGIN_STRING='open' +else + LOGIN_STRING="lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW" +fi + +TEMP=$(ipmitool -I $LOGIN_STRING sdr type temperature |grep Inlet |grep degrees |grep -Po '\d{2}' | tail -1) echo "Current Temp is $TEMP C" if [ $TEMP -gt $MAXTEMP ]; then echo "Temp is too high. Activating dynamic fan control" - ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x01 + ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x01 0x01 else echo "Temp is OK. Using manual fan control" - ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00 - ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff $FANSPEED + ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x01 0x00 + ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x02 0xff $FANSPEED fi diff --git a/startup.sh b/startup.sh index 5f6b85a..4a45965 100644 --- a/startup.sh +++ b/startup.sh @@ -1,9 +1,14 @@ +#!/bin/bash + echo $IDRAC_HOST >> /host.txt echo $IDRAC_USER >> /user.txt echo $IDRAC_PW >> /pw.txt echo $FANSPEED >> /fanspeed.txt echo "Host: `cat /host.txt`" -echo "User: `cat /user.txt`" -echo "PW: `cat /pw.txt`" +if [[ $IDRAC_HOST != "local" ]] +then + echo "User: `cat /user.txt`" + echo "PW: `cat /pw.txt`" +fi echo "Fan speed `cat /fanspeed.txt`"