ulvis.paste.net

Paste Search Dynamic
Recent pastes
set-fans-amd.sh
  1. #!/bin/bash
  2. #
  3. # Create custom fan SPEED for AMD GPUs to Hive OS
  4. # adapted from Nvidia script from @jimkarter at Hive OS Chat (English) Telegram Group by
  5. # @alecsandrofs (just a "normal" brazilian guy)
  6. # Set display, else nvidia commands will not work (commented not necessary to AMD I think)
  7. #export DISPLAY=:0
  8. #You can adjust temp/fanspeed below as you wish
  9. #Use at your own risk. I run it every minute with following  in /hive/etc/crontab.root file:
  10. # "* * * * * /home/user/bin/set-fans.sh >> /dev/null" without quotes.
  11.  
  12. echo "---------------"
  13. /bin/date
  14. # Get number of AMD GPUs in the system
  15. NO_OF_GPUS=`/hive/sbin/amdcovc |grep -i adapter| wc |awk '{print $1}'`
  16. echo "$NO_OF_GPUS GPUs found."
  17. NO_OF_GPUS=$((NO_OF_GPUS - 1));
  18. # For every GPU, check the temperature and set fan speed
  19. for i in `seq 0 $NO_OF_GPUS`;
  20. do
  21.         TEMP=`/hive/sbin/amdcovc -a $i |grep "Temp" | awk '{print $12}'`
  22.         echo "GPU $i : Temp: $TEMP"
  23.  
  24.         if [ "$TEMP" -ge 75 ]; then
  25.                         /hive/sbin/amdcovc fanspeed:$i=100
  26.                 elif [ "$TEMP" -ge 73 ]; then
  27.                         /hive/sbin/amdcovc fanspeed:$i=95
  28.                 elif [ "$TEMP" -ge 72 ]; then
  29.                                 /hive/sbin/amdcovc fanspeed:$i=90
  30.                 elif [ "$TEMP" -ge 70 ]; then
  31.                                 /hive/sbin/amdcovc fanspeed:$i=85
  32.                 elif [ "$TEMP" -ge 68 ]; then
  33.                                 /hive/sbin/amdcovc fanspeed:$i=80
  34.                 elif [ "$TEMP" -ge 66 ]; then
  35.                                 /hive/sbin/amdcovc fanspeed:$i=75
  36.                 elif [ "$TEMP" -ge 64 ]; then
  37.                                 /hive/sbin/amdcovc fanspeed:$i=70
  38.                 elif [ "$TEMP" -ge 61 ]; then
  39.                                 /hive/sbin/amdcovc fanspeed:$i=65
  40.                 elif [ "$TEMP" -ge 55 ]; then
  41.                                 /hive/sbin/amdcovc fanspeed:$i=55
  42.                 elif [ "$TEMP" -ge 52 ]; then
  43.                                 /hive/sbin/amdcovc fanspeed:$i=45
  44.                         else
  45.                                 /hive/sbin/amdcovc fanspeed:$i=35
  46.                         fi
  47.         done
Parsed in 0.019 seconds