-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpowersave
More file actions
executable file
·28 lines (26 loc) · 825 Bytes
/
powersave
File metadata and controls
executable file
·28 lines (26 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Checking root user
#if [ "$(id -u)" != "0" ]; then
# echo "This script must be run as root" 1>&2
# exit 1
#fi
# Checking current state
if [ `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor` = 'userspace' ]
then
# Lowest speed and ondemand governor for all cores
for CPU in /sys/devices/system/cpu/*/cpufreq/
do
echo `cat ${CPU}cpuinfo_min_freq` | tee ${CPU}scaling_setspeed
echo ondemand | tee ${CPU}scaling_governor
done
else
# And full speed for all cores
for CPU in /sys/devices/system/cpu/*/cpufreq/
do
echo userspace | tee ${CPU}scaling_governor
echo `cat ${CPU}cpuinfo_min_freq` | tee ${CPU}scaling_setspeed
done
fi
TEMP=$((`cat /sys/class/thermal/thermal_zone0/temp`/1000))
echo "CPU Temp: ${TEMP}C"
# Developed by gear. You can contact me by misty.g3ar@gmail.com