Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- TIME=5 #seconds
- CPU_UP_TH=65
- GPU_UP_TH=70
- CPU_LOW_TH=55
- GPU_LOW_TH=65
- while :
- do
- cpu0=`sysctl hw.sensors.cpu0.temp0 | cut -d= -f 2 | cut -d. -f 1`
- gpu0=`sysctl hw.sensors.itherm0.temp4 | cut -d= -f 2 | cut -d. -f 1`
- apm=`/usr/sbin/apm -P`
- echo "CPU0: ${cpu0} GPU0: ${gpu0} APM: ${apm}"
- if [ ${cpu0} -gt ${CPU_UP_TH} ] || [ ${gpu0} -gt ${GPU_UP_TH} ]; then
- if [ ${apm} == 1 ]; then
- /usr/sbin/apm -C
- echo "apm -C"
- fi
- fi
- if [ ${cpu0} -lt ${CPU_LOW_TH} ] || [ ${gpu0} -lt ${GPU_LOW_TH} ]; then
- if [ ${apm} == 2 ]; then
- /usr/sbin/apm -A
- echo "apm -A"
- fi
- fi
- sleep ${TIME}
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement