Skip to content

Instantly share code, notes, and snippets.

@marcellmars
Created September 18, 2015 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcellmars/62563ac46f0fdc0106a2 to your computer and use it in GitHub Desktop.
Save marcellmars/62563ac46f0fdc0106a2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import time
import subprocess
import datetime
while True:
tout = subprocess.check_output(["acpi", "-t"])
with open("/home/m/devel/sammox/laptop_temp", "w") as f:
f.write("{} {}".format(str(datetime.datetime.now()), tout))
temp = float(tout.split(", ")[1].split(" ")[0])
if temp > 65 and temp < 68:
subprocess.Popen("echo level 5 > /proc/acpi/ibm/fan", shell=True)
elif temp > 67 and temp < 69:
subprocess.Popen("echo level 6 > /proc/acpi/ibm/fan", shell=True)
elif temp > 69:
subprocess.Popen("echo level full-speed > /proc/acpi/ibm/fan", shell=True)
else:
subprocess.Popen("echo level auto > /proc/acpi/ibm/fan", shell=True)
time.sleep(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment