Last active
August 29, 2015 13:58
-
-
Save stuthedew/10011611 to your computer and use it in GitHub Desktop.
Python script to stop Raspberry Pi Watchdog if settings cause continues rebooting. Must be run from second computer. Attempts to connect to raspberry pi for about a minute. Start as soon as problematic Raspberry Pi begins startup
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
import spur | |
import sys | |
#change to match your setup if different | |
#///////////////////////////////// | |
piHostName= 'raspberrypi.local' | |
piUsername = 'pi' | |
piPasswd = '' #Enter password | |
verbose = False | |
#//////////////////////////////// | |
attempts = 0 | |
while attempts < 120: | |
try: | |
print("attempt " + str(attempts) + "...") | |
shell = spur.SshShell(hostname=piHostName, username=piUsername, password=piPasswd) | |
print("connected") | |
with shell: | |
result = shell.run(['sudo', 'update-rc.d', 'watchdog', 'disable']) | |
print(result.output) | |
result = shell.run(['sudo', 'service', 'watchdog', 'stop']) | |
print(result.output) | |
break #if successful, leave loop | |
except Exception, e: | |
if (verbose): | |
print e | |
print("failed") | |
attempts +=1 | |
time.sleep(0.5) | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment