Skip to content

Instantly share code, notes, and snippets.

@Sharkbyteprojects
Last active September 24, 2020 19:38
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 Sharkbyteprojects/a78eb090320c34e69e175001c6683731 to your computer and use it in GitHub Desktop.
Save Sharkbyteprojects/a78eb090320c34e69e175001c6683731 to your computer and use it in GitHub Desktop.
Raspberry Pi Reboot if to hot
#!/usr/bin/env python3
# <c> Sharkbyteprojects
# https://gist.github.com/Sharkbyteprojects/a78eb090320c34e69e175001c6683731
# HOW TO INSTALL ON PI:
# Look at the Comment https://gist.github.com/Sharkbyteprojects/a78eb090320c34e69e175001c6683731#gistcomment-3466290
import os
import time
while True:
xxxx=float(os.popen("vcgencmd measure_temp").readline().replace("'C\n", "").replace("temp=",""))
print(xxxx)
if(xxxx > 70):
print("Reboot")
os.system("sudo reboot")
time.sleep(0.1)
#!/bin/sh
#THIS APP NEED ROOT PERM
echo "<c>Sharkbyteprojects"
cd /
echo Downloading
wget https://gist.github.com/Sharkbyteprojects/a78eb090320c34e69e175001c6683731/raw/442ac91cd018b97b0104a8bf106a34d8e6e44fc6/emgc.py
chmod +x emgc.py
echo "Add to autostart"
echo "@reboot root /emgc.py" >> /etc/crontab
echo Complete
#!/usr/bin/env python3
# <c> Sharkbyteprojects
import os
print("<c>Sharkbyteprojects")
print("Run this Only under Root")
os.chdir("/")
print("\nDownloading")
os.system("wget https://gist.github.com/Sharkbyteprojects/a78eb090320c34e69e175001c6683731/raw/442ac91cd018b97b0104a8bf106a34d8e6e44fc6/emgc.py")
print("Download Complete\nConfig")
os.system("chmod +x emgc.py")
with open("/etc/crontab", "a+") as file_object:
data = file_object.read(100)
if len(data) > 0:
file_object.write("\n")
file_object.write("@reboot root /emgc.py")
file_object.close()
print("Complete Installed")
@Sharkbyteprojects
Copy link
Author

Sharkbyteprojects commented Sep 24, 2020

INSTALL THE SCRIPT with shell;
curl -L https://gist.github.com/Sharkbyteprojects/a78eb090320c34e69e175001c6683731/raw/c30ef342082c5a6168a0fcec47fb7b4b25fcf30f/install.sh | sudo sh

or install it with python script

curl -L https://gist.github.com/Sharkbyteprojects/a78eb090320c34e69e175001c6683731/raw/6787c135d5e2235e2cab6d921ff85d4c02b6e9e9/pythonInstall.py | sudo python3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment