WizardKit/scripts/apple-fans
2Shirt b368b27faa
New project organization
* Script work is brought into better focus
* New layout will be used to better package the python scripts
* No hidden folders (they will be hidden at build time)
* All building should be done under setup/
  * Avoids ambiguous .bin/.cbin folders at root of project
2019-06-28 18:06:43 -06:00

37 lines
780 B
Bash
Executable file

#!/bin/bash
#
## Wizard Kit: Apple fan speed tool
SMCPATH="/sys/devices/platform/applesmc.768"
SET_MAX="True"
function usage {
echo "Usage: $(basename "$0") auto|max"
echo " e.g. $(basename "$0") max"
}
# Set mode
case $1 in
auto)
SET_MAX="False";;
max)
SET_MAX="True";;
*)
usage
exit 1;;
esac
if [[ -e "$SMCPATH" ]]; then
if [[ "$SET_MAX" == "True" ]]; then
# Set fans to max RPM
for fan in $SMCPATH/fan*max; do
echo '1' | sudo tee ${fan:0:-4}_manual > /dev/null
cat $fan | sudo tee ${fan:0:-4}_output > /dev/null
done
else
# Set fans to auto
for fan in $SMCPATH/fan*manual; do
echo '0' | sudo tee $fan > /dev/null
done
fi
fi