forked from f1vefour/odroid-xu4-fan-control
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaemon.sh
More file actions
executable file
·51 lines (39 loc) · 953 Bytes
/
daemon.sh
File metadata and controls
executable file
·51 lines (39 loc) · 953 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/sh
# Exit behavior
trap cleanup EXIT
cleanup() {
echo $DEFAULT_SPEED > $FAN_CONTROL
}
WAIT_TIME=2
# Speed control
DEFAULT_SPEED=20
# Control files
FAN_CONTROL=/sys/class/hwmon/hwmon1/pwm1
TEMP_FILE=/sys/class/hwmon/hwmon2/temp1_input
while true;
do
# Get the temperature
current_temperature=$(cat $TEMP_FILE)
new_speed=0
if [ $current_temperature -ge 75000 ]; then
new_speed=255
elif [ $current_temperature -ge 70000 ]; then
new_speed=200
elif [ $current_temperature -ge 68000 ]; then
new_speed=130
elif [ $current_temperature -ge 66000 ]; then
new_speed=80
elif [ $current_temperature -ge 63000 ]; then
new_speed=80
elif [ $current_temperature -ge 60000 ]; then
new_speed=0
elif [ $current_temperature -ge 58000 ]; then
new_speed=0
elif [ $current_temperature -ge 55000 ]; then
new_speed=0
else
new_speed=0
fi
echo $new_speed > $FAN_CONTROL
sleep $WAIT_TIME
done