-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfancontrol.sh
50 lines (41 loc) · 1.18 KB
/
fancontrol.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/su root
#what is ur sensor called like on the sensors command
CPU_PREFIX="temp1"
#this is probably the worst command ever but it works
CPU_TEMP=$(sensors | grep "$CPU_PREFIX")
CPU_CUT=${CPU_TEMP#*+}
#do the magic stuff
while true;
do
CPU_TEMP=$(sensors | grep "$CPU_PREFIX")
CPU_CUT=${CPU_TEMP#*+}
if [ "${CPU_CUT%%.*}" -le 60 ]
then
echo level 1 | tee /proc/acpi/ibm/fan
fi
if [ "${CPU_CUT%%.*}" -ge 65 ] && [ "${CPU_CUT%%.*}" -le 70 ]
then
echo level 2 | tee /proc/acpi/ibm/fan
fi
if [ "${CPU_CUT%%.*}" -ge 70 ] && [ "${CPU_CUT%%.*}" -le 75 ]
then
echo level 3 | tee /proc/acpi/ibm/fan
fi
if [ "${CPU_CUT%%.*}" -ge 75 ] && [ "${CPU_CUT%%.*}" -le 80 ]
then
echo level 4 | tee /proc/acpi/ibm/fan
fi
if [ "${CPU_CUT%%.*}" -ge 80 ] && [ "${CPU_CUT%%.*}" -le 85 ]
then
echo level 5 | tee /proc/acpi/ibm/fan
fi
if [ "${CPU_CUT%%.*}" -ge 85 ] && [ "${CPU_CUT%%.*}" -le 90 ]
then
echo level 6 | tee /proc/acpi/ibm/fan
fi
if [ "${CPU_CUT%%.*}" -ge 90 ]
then
echo level 7 | tee /proc/acpi/ibm/fan
fi
sleep 2;
done