From time to time feeder.py freezes and I currently have no clue what's the cause of this behavior. Suddenly the status light which should be blinking lights up permanently instead...
As a workaround I've added a python script called watchdog.py to the github repo. The watchdog starts feeder.py and whenever it crashes feeder.py will be called again by the watchdog:
#!/usr/bin/env python
import time, subprocess
COMMAND=['./feeder.py']
LOGFILE='watchdog.log'
def writelog(message):
with open(LOGFILE,'a') as f:
f.write("{0} {1}\n".format(time.asctime( time.localtime(time.time())),
message))
writelog("Starting")
while True:
rc = subprocess.call(COMMAND)
if rc >= 0:
writelog("Exited with {0} status".format(rc))
else:
writelog("Exited on signal {0}".format(0-rc))
writelog("Restarting")