-
Notifications
You must be signed in to change notification settings - Fork 26
/
acpi-thinkpad-fan.sh
executable file
·27 lines (21 loc) · 1.4 KB
/
acpi-thinkpad-fan.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
#! /bin/sh
# PUT SOMETHING LIKE THAT INTO crontab -e COMMAND
# ACPI/IBM/FAN
# * * * * * ~/scripts/acpi-thinkpad-fan.sh
if ! kldstat | grep -q acpi_ibm.ko
then
doas kldload acpi_ibm 1> /dev/null 2> /dev/null
fi
doas sysctl dev.acpi_ibm.0.fan=0 1> /dev/null 2> /dev/null
TEMP=$( sysctl -n hw.acpi.thermal.tz0.temperature | awk -F'.' '{print $1}' )
[ ${TEMP} -lt 50 ] && doas sysctl dev.acpi_ibm.0.fan_level=0 1> /dev/null 2> /dev/null && exit 0
[ ${TEMP} -lt 55 ] && doas sysctl dev.acpi_ibm.0.fan_level=1 1> /dev/null 2> /dev/null && exit 0
[ ${TEMP} -lt 60 ] && doas sysctl dev.acpi_ibm.0.fan_level=2 1> /dev/null 2> /dev/null && exit 0
[ ${TEMP} -lt 70 ] && doas sysctl dev.acpi_ibm.0.fan_level=4 1> /dev/null 2> /dev/null && exit 0
[ ${TEMP} -lt 80 ] && doas sysctl dev.acpi_ibm.0.fan_level=6 1> /dev/null 2> /dev/null && exit 0
[ ${TEMP} -gt 80 ] && doas sysctl dev.acpi_ibm.0.fan_level=7 1> /dev/null 2> /dev/null && exit 0
# [ ${TEMP} -lt 50 ] && doas sysctl dev.acpi_ibm.0.fan_level=0 1> /dev/null 2> /dev/null && exit 0
# [ ${TEMP} -lt 60 ] && doas sysctl dev.acpi_ibm.0.fan_level=1 1> /dev/null 2> /dev/null && exit 0
# [ ${TEMP} -lt 70 ] && doas sysctl dev.acpi_ibm.0.fan_level=3 1> /dev/null 2> /dev/null && exit 0
# [ ${TEMP} -lt 80 ] && doas sysctl dev.acpi_ibm.0.fan_level=5 1> /dev/null 2> /dev/null && exit 0
# [ ${TEMP} -gt 80 ] && doas sysctl dev.acpi_ibm.0.fan_level=7 1> /dev/null 2> /dev/null && exit 0