Skip to content

Instantly share code, notes, and snippets.

@presianbg
Created March 31, 2016 07:41
Show Gist options
  • Select an option

  • Save presianbg/9c0fa217327f8110bc61a24090db718c to your computer and use it in GitHub Desktop.

Select an option

Save presianbg/9c0fa217327f8110bc61a24090db718c to your computer and use it in GitHub Desktop.
dynamic thermald fan detection
cat /etc/rc.d/rc.local
#!/bin/bash
/root/fan_check.py
exit 0
cat /root/fan_check.py
#!/usr/bin/python3
import os
import sys
import fileinput
def change_path(find_word, replace_with):
for line in fileinput.FileInput("/etc/thermald/thermal-conf.xml", inplace=1):
line = line.replace(find_word, replace_with)
sys.stdout.write(line)
if (os.path.isdir("/sys/devices/platform/asus-nb-wmi/hwmon/hwmon1")):
change_path('hwmon2', 'hwmon1')
else:
change_path('hwmon1', 'hwmon2')
cat /usr/lib/systemd/system/thermald.service
[Unit]
Description=Thermal Daemon Service
After=rc-local.service
[Service]
Type=dbus
SuccessExitStatus=1
BusName=org.freedesktop.thermald
ExecStart=/usr/sbin/thermald --no-daemon --dbus-enable
[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.thermald.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment