Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yorickpeterse
Last active December 15, 2015 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yorickpeterse/5211869 to your computer and use it in GitHub Desktop.
Save yorickpeterse/5211869 to your computer and use it in GitHub Desktop.
Poor man's fan control for Macbooks that run Linux.
#!/usr/bin/env bash
set -e
minimum=2000
medium=4500
maximum=6200
value=$minimum
case "$1" in
"min")
value=$minimum
;;
"med")
value=$medium
;;
"max")
value=$maximum
;;
*)
value=$1
;;
esac
if [[ -z "$(echo $value | grep -P '^\d+$')" ]]
then
echo 'Only numeric values can be specified'
exit 1
fi
echo $value | sudo tee /sys/devices/platform/applesmc.768/fan1_min
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment