Skip to content

Instantly share code, notes, and snippets.

@nirix
Forked from yorickpeterse/fan-control.sh
Created March 21, 2013 16:07
Show Gist options
  • Save nirix/5214248 to your computer and use it in GitHub Desktop.
Save nirix/5214248 to your computer and use it in GitHub Desktop.
#!/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