$ chmod +x /home/pi/pypy.py
$ cat /home/pi/pypy.py
#!/usr/bin/python
import urllib2
import os
import time
from time import sleep
while True:
time.sleep(2)
try:
contents = urllib2.urlopen("https://www.b4x.com/commands").read()
if contents in ('reboot', 'reboots'):
os.system('echo "0" > /sys/class/gpio/gpio4/value')
os.system('echo "0" > /sys/class/gpio/gpio18/value')
sleep(0.5)
os.system('echo "1" > /sys/class/gpio/gpio4/value')
os.system('echo "1" > /sys/class/gpio/gpio18/value')
except:
print "ERROR - so what continue?"
#
# - Run infinite
#