Skip to content

Instantly share code, notes, and snippets.

@bhaskarkc
Last active October 16, 2020 07:44
Show Gist options
  • Save bhaskarkc/9c88209b8097547168d21497336c8bb5 to your computer and use it in GitHub Desktop.
Save bhaskarkc/9c88209b8097547168d21497336c8bb5 to your computer and use it in GitHub Desktop.
Systemd conf for thinkfan, update temp hwmon before starting the service.
# file location: /usr/lib/systemd/system/thinkfan.service
[Unit]
Description=simple and lightweight fan control program
Wants=lm_sensors.service
After=lm_sensors.service
[Service]
Type=forking
ExecStart=/home/cybapunkz/.local/bin/thinkfan $THINKFAN_ARGS
PIDFile=/run/thinkfan.pid
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
Also=thinkfan-wakeup.service
#!/bin/env bash
#
# file location: /home/cybapunkz/.local/bin/thinkfan
# Author: Bhaskar K C <xlinkerz@gmail.com>
# Move this file to /usr/bin/thinkfan-config
sed -i '/^hwmon/d' /etc/thinkfan.conf
find /sys/devices -type f -name 'temp*_input' | xargs -I {} echo "hwmon {}" |
sed -e '/thinkpad_hwmon\/hwmon\/hwmon[0-9]\/temp2_input$/ s/^/#\ /g' \
>>/etc/thinkfan.conf
/usr/bin/thinkfan $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment