T560 fan control issue after wake-up - Ubuntu 18.04

# script fixes that the fan is always on max "randomly" if waked up from sleep..


# cat t560fan.sh
#!/bin/bash
# Ubuntu 18.04 on T560
# last update: 2019 jun 08
#########################################
# IMPLEMENT IT in roots crontab:
# * * * * * /bin/bash /root/t560fan.sh
# chattr +i /root/t560fan.sh
#########################################
# script fixes that the fan is always on max "randomly" if waked up from sleep..
# https://www.thinkwiki.org/wiki/How_to_control_fan_speed
#########################################

# START MAIN PART

# get temperature
TEMPERATURE=$(sensors|grep C|cut -d'+' -f2|sort -u|cut -d. -f1|grep '[0-9]'|tail -1)

# set the fan speed based on highest temp
if [ "$TEMPERATURE" -le 50 ]; then echo "level 0" > /proc/acpi/ibm/fan; fi # plain webbrowsing, video play
if [ "$TEMPERATURE" -gt 50 ]; then echo "level 2" > /proc/acpi/ibm/fan; fi
if [ "$TEMPERATURE" -ge 60 ]; then echo "level 4" > /proc/acpi/ibm/fan; fi
if [ "$TEMPERATURE" -ge 70 ]; then echo "level 7" > /proc/acpi/ibm/fan; fi # cpu/ssd/etc on max load, max cooling needed

# if TEMPERATURE variable is empty for some unkown reason, run on full speed, maybe the user will notice :)
if [ -z "$TEMPERATURE" ]; then echo "level 7" > /proc/acpi/ibm/fan; fi

#########################################

Hozzászólások

Szolgálati közlemény:

Zárd be a code tag-et, utána törd el break-kel, majd nyisd meg a code tag-et, a végén meg gondolom, le van már zárva.

Vázlat:

code
rövid bevezető
/code
break
code
bevezető folytatása
/code

tr '[:lower:]' '[:upper:]' <<<locsemege
LOCSEMEGE

Amúgy, ha a TEMPERATURE meghatározásához ilyen sok dolog kell, célszerűbb egyetlen awk scripttel felfalni a problémát.

tr '[:lower:]' '[:upper:]' <<<locsemege
LOCSEMEGE