Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pauven

Members
  • Joined

  • Last visited

Everything posted by Pauven

  1. Thanks Guzzi and aiden, I didn't find that script in my searching. Setting up a cron job in my go script wasn't too hard, but obviously not a one-liner. I looked at the code, and it seems both scripts have a common origin, as many of the variable names are exactly the same, though your script does appear to be newer, more polished and user friendly. Wish I had found it earlier.
  2. NEW VERSION OF THE unraid-fan-speed.sh SCRIPT! NEW v0.5: By Pauven: Added linear PWM logic to slowly ramp speed when fan is between HIGH and OFF. I'm picking up where xamindar left off - thank you xamindar for an excellent script! When I first used the script, I was surprised when the fans instantly changed from the Low speed value to the High speed value when there was only a single degree temperature increase. Looking at the code, I did not see any linear speed ramping logic... so I added it! Here's an example of the new logic, based upon the current values in the script posted below: With an FAN_OFF_TEMP of 30 and a FAN_HIGH_TEMP OF 40, and with a FAN_LOW_PWM of 80 and a FAN_HIGH_PWM of 255, the new logic will perform some math and figure out that there are 9 PWM increments of 19 between 80 and 255, corresponding to temps 31-39. Using the above values, the fan speed would ramp as follows: 31 degrees = 80 PWM 32 degrees = 99 PWM 33 degrees = 118 PWM 34 degrees = 137 PWM 35 degrees = 156 PWM 36 degrees = 175 PWM 37 degrees = 194 PWM 38 degrees = 213 PWM 39 degrees = 232 PWM 40 degrees = 255 PWM The math is automatic, you just need to set the user variables the same as before. Enjoy! -Paul unraid-fan-speed.sh #!/bin/bash # unraid_array_fan.sh v0.5 # v0.1: By xamindar: First try at it. # v0.2: Made a small change so the fan speed on low doesn't fluctuate every time the script is run. # v0.3: It will now enable fan speed change before trying to change it. I missed # it at first because pwmconfig was doing it for me while I was testing the fan. # v0.4: Corrected temp reading to "Temperature_Celsius" as my new Seagate drive # was returning two numbers with just "Temperature". # v0.5: By Pauven: Added linear PWM logic to slowly ramp speed when fan is between HIGH and OFF. # A simple script to check for the highest hard disk temperatures in an array # or backplane and then set the fan to an apropriate speed. Fan needs to be connected # to motherboard with pwm support, not array. # DEPENDS ON:grep,awk,smartctl,hdparm ### VARIABLES FOR USER TO SET ### # Amount of drives in the array. Make sure it matches the amount you filled out below. NUM_OF_DRIVES=15 # unRAID drives that are in the array/backplane of the fan we need to control HD[1]=/dev/sdb HD[2]=/dev/sdc HD[3]=/dev/sdd HD[4]=/dev/sde HD[5]=/dev/sdf HD[6]=/dev/sdg HD[7]=/dev/sdh HD[8]=/dev/sdi HD[9]=/dev/sdj HD[10]=/dev/sdk HD[11]=/dev/sdl HD[12]=/dev/sdm HD[13]=/dev/sdn HD[14]=/dev/sdo HD[15]=/dev/sdp #HD[16]=/dev/sdq #HD[17]=/dev/sdr #HD[18]=/dev/sds #HD[19]=/dev/sdt #HD[20]=/dev/sdu #HD[21]=/dev/sdv #HD[22]=/dev/sdw #HD[23]=/dev/sdx #HD[24]=/dev/sdy # Temperatures to change fan speed at # Any temp between OFF and HIGH will cause fan to run on low speed setting FAN_OFF_TEMP=30 # Anything this number and below - fan is off FAN_HIGH_TEMP=40 # Anything this number or above - fan is high speed # Fan speed settings. Run pwmconfig (part of the lm_sensors package) to determine # what numbers you want to use for your fan pwm settings. Should not need to # change the OFF variable, only the LOW and maybe also HIGH to what you desire. # Any real number between 0 and 255. # # FAN_OFF_PWM=100 # FAN_LOW_PWM=150 # FAN_HIGH_PWM=255 FAN_OFF_PWM=70 FAN_LOW_PWM=80 FAN_HIGH_PWM=255 # Fan device. Depends on your system. pwmconfig can help with finding this out. # pwm1 is usually the cpu fan. You can "cat /sys/class/hwmon/hwmon0/device/fan1_input" # or fan2_input and so on to see the current rpm of the fan. If 0 then fan is off or # there is no fan connected or motherboard can't read rpm of fan. # ARRAY_FAN=/sys/class/hwmon/hwmon1/device/pwm2 ARRAY_FAN=/sys/class/hwmon/hwmon1/device/pwm2 ### END USER SET VARIABLES ### # Program variables - do not modify HIGHEST_TEMP=0 CURRENT_DRIVE=1 CURRENT_TEMP=0 # Linear PWM Logic Variables - do not modify NUM_STEPS=$((FAN_HIGH_TEMP - FAN_OFF_TEMP - 1)) PWM_INCREMENT=$(( (FAN_HIGH_PWM - FAN_LOW_PWM) / NUM_STEPS)) echo "Linear PWM Range is "$FAN_LOW_PWM" to "$FAN_HIGH_PWM" in "$NUM_STEPS" increments of "$PWM_INCREMENT # while loop to get the highest temperature of active drives. # If all are spun down then high temp will be set to 0. while [ "$CURRENT_DRIVE" -le "$NUM_OF_DRIVES" ] do SLEEPING=`hdparm -C ${HD[$CURRENT_DRIVE]} | grep -c standby` if [ "$SLEEPING" == "0" ]; then CURRENT_TEMP=`smartctl -d ata -A ${HD[$CURRENT_DRIVE]} | grep -m 1 -i Temperature_Celsius | awk '{print $10}'` if [ "$HIGHEST_TEMP" -le "$CURRENT_TEMP" ]; then HIGHEST_TEMP=$CURRENT_TEMP fi fi #echo $CURRENT_TEMP let "CURRENT_DRIVE+=1" done echo "Highest temp is: "$HIGHEST_TEMP # Enable speed change on this fan if not already if [ "$ARRAY_FAN" != "1" ]; then echo 1 > "${ARRAY_FAN}_enable" fi # Set the fan speed based on highest temperature if [ "$HIGHEST_TEMP" -le "$FAN_OFF_TEMP" ]; then # set fan to off echo $FAN_OFF_PWM > $ARRAY_FAN echo "Setting pwm to: "$FAN_OFF_PWM elif [ "$HIGHEST_TEMP" -ge "$FAN_HIGH_TEMP" ]; then # set fan to full speed echo $FAN_HIGH_PWM > $ARRAY_FAN echo "Setting pwm to: "$FAN_HIGH_PWM else CURRENT_SPEED=`cat $ARRAY_FAN` # set fan to full speed first to make sure it spins up then change it to low setting. if [ "$CURRENT_SPEED" -lt "$FAN_LOW_PWM" ]; then echo $FAN_HIGH_PWM > $ARRAY_FAN sleep 2 fi # Calculate target fan PWM speed as a linear value between FAN_HIGH_PWM and FAN_LOW_PWM FAN_LINEAR_PWM=$(( ((HIGHEST_TEMP - FAN_OFF_TEMP - 1) * PWM_INCREMENT) + FAN_LOW_PWM)) echo $FAN_LINEAR_PWM > $ARRAY_FAN echo "Setting pwm to: "$FAN_LINEAR_PWM fi

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.