Created
February 5, 2016 15:30
-
-
Save cglosser/490a9c93f41b9f4b5f49 to your computer and use it in GitHub Desktop.
Revisions
-
rayhem created this gist
Feb 5, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ #!/bin/bash #smartfancontrol.sh #### enter your preferred values here ################## speed_min=2000 #RPM speed_max=5500 #RPM temp_min=46 #degrees celsius temp_max=60 #degrees celsius ########## Do not edit below this line ################### while true; do echo 1 > /sys/devices/platform/applesmc.768/fan2_manual temp=$(/usr/sbin/smartctl -A /dev/sda | grep ^194 | awk '{print $10}') if [[ $temp -lt $temp_min ]]; then speed=$speed_min elif [[ $temp -gt $temp_max ]]; then speed=$speed_max else x=$(($speed_max-$speed_min)) y=$(($(($temp-$temp_min))*100)) z=$(($(($temp_max-$temp_min))*100)) a=$(($x*$y/$z)) speed=$(($a+$speed_min)) fi echo $speed >/sys/devices/platform/applesmc.768/fan2_output printf '[ %i C | %i rpm ]\n' $temp $speed sleep 10 done