Created
September 18, 2015 22:37
-
-
Save marcellmars/62563ac46f0fdc0106a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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