Open graczyk opened 10 years ago
monitor.sh does not properly restart the API fetcher. Thankfully, this code is great easy! From the explanation from SO (http://stackoverflow.com/questions/696839/how-do-i-write-a-bash-script-to-restart-a-process-if-it-dies):
If the exit status is 0, it means it ended gracefully (which means you asked it to shut down somehow, and it did so successfully). In that case we don't want to restart it (we just asked it to shut down!).
We then look at the python for the exit code, thankfully, I am using emacs so this is easy! We go to the documentation (http://docs.python.org/2/library/sys.html#sys.exit)
If it is an integer, zero is considered “successful termination” and any nonzero value is considered “abnormal termination” by shells and the like.
We can resolve this problem with the following steps
sudo apt-get remove emacs vi api_crawler.py :%s/sys.exit()/sys.exit(666)/g
We can then complete the test using you_monster.py to distribute unstoppable processes.
:+1:
monitor.sh does not properly restart the API fetcher. Thankfully, this code is great easy! From the explanation from SO (http://stackoverflow.com/questions/696839/how-do-i-write-a-bash-script-to-restart-a-process-if-it-dies):
We then look at the python for the exit code, thankfully, I am using emacs so this is easy! We go to the documentation (http://docs.python.org/2/library/sys.html#sys.exit)
We can resolve this problem with the following steps
We can then complete the test using you_monster.py to distribute unstoppable processes.