{"action":"created","comment":{"url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/comments/53432406","id":53432406,"diff_hunk":"@@ -0,0 +1,63 @@\n+#!/usr/bin/env python3\n+\n+import sys\n+import subprocess\n+import time\n+#process names from text file stored into array\n+#sleep after each check for 2 secs\n+\n+\n+def main(): \n+    #read program names from file and put them into an array\n+    fileName = open(sys.argv[1])\n+    programs = fileName.read().splitlines()\n+    fileName.close()\n+    \n+    #start up programs in separate processes\n+    p0 = subprocess.Popen(programs[0])\n+    p1 = subprocess.Popen(programs[1])\n+    '''\n+    p2 = subprocess.Popen(programs[2])\n+    p3 = subprocess.Popen(programs[3])\n+    '''\n+    \n+    MAXRESTART = 10\n+    timesRestarted = [0, 0, 0, 0]\n+    \n+    #check processes and respond accordingly\n+    while True:\n+        if(p0.poll() is not None):\n+            #print(programs[0], \"died\")\n+            p0 = subprocess.Popen(programs[0])\n+            timesRestarted[0] += 1\n+            if (timesRestarted[0] > MAXRESTART):\n+                print(programs[0], \"exceeded\", MAXRESTART, \"restarts\")\n+                return\n+        if(p1.poll() is not None):\n+            #print(programs[1], \"died\")\n+            p1 = subprocess.Popen(programs[1])\n+            timesRestarted[1] += 1\n+            if (timesRestarted[1] > MAXRESTART):\n+                print(programs[1], \" exceeded\", MAXRESTART, \" restarts\")\n+                return     \n+        '''\n+        if(p2.poll() is not None):\n+            #print(programs[2], \"died\")\n+            p2 = subprocess.Popen(programs[2])\n+            timesRestarted[2] += 1\n+            if (timesRestarted[2] > MAXRESTART):\n+                print(programs[2], \"exceeded\", MAXRESTART, \"restarts\")\n+                return\n+        if(p3.poll() is not None):\n+            #print(programs[3], \"died\")\n+            p3 = subprocess.Popen(programs[3])\n+            timesRestarted[3] += 1\n+            if (timesRestarted[3] > MAXRESTART):\n+                print(programs[3], \"exceeded\", MAXRESTART, \"restarts\")\n+                return  \n+        '''\n+        \n+        time.sleep(2)\n+        \n+if __name__ == '__main__':\n+    main()","path":"startUp.py","position":63,"original_position":63,"commit_id":"9c99784ab05338ffcf3dcfe6d7a7c8ee7eefee30","original_commit_id":"9c99784ab05338ffcf3dcfe6d7a7c8ee7eefee30","user":{"login":"enochtsang","id":9893396,"avatar_url":"https://avatars.githubusercontent.com/u/9893396?v=3","gravatar_id":"","url":"https://api.github.com/users/enochtsang","html_url":"https://github.com/enochtsang","followers_url":"https://api.github.com/users/enochtsang/followers","following_url":"https://api.github.com/users/enochtsang/following{/other_user}","gists_url":"https://api.github.com/users/enochtsang/gists{/gist_id}","starred_url":"https://api.github.com/users/enochtsang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enochtsang/subscriptions","organizations_url":"https://api.github.com/users/enochtsang/orgs","repos_url":"https://api.github.com/users/enochtsang/repos","events_url":"https://api.github.com/users/enochtsang/events{/privacy}","received_events_url":"https://api.github.com/users/enochtsang/received_events","type":"User","site_admin":false},"body":"Good practice here, should definitely be like this :)","created_at":"2016-02-19T08:10:54Z","updated_at":"2016-02-19T08:10:54Z","html_url":"https://github.com/UCSolarCarTeam/Domovoi/pull/1#discussion_r53432406","pull_request_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/comments/53432406"},"html":{"href":"https://github.com/UCSolarCarTeam/Domovoi/pull/1#discussion_r53432406"},"pull_request":{"href":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/1","id":59286131,"html_url":"https://github.com/UCSolarCarTeam/Domovoi/pull/1","diff_url":"https://github.com/UCSolarCarTeam/Domovoi/pull/1.diff","patch_url":"https://github.com/UCSolarCarTeam/Domovoi/pull/1.patch","issue_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues/1","number":1,"state":"open","locked":false,"title":"Initial PR to see if it's on right track","user":{"login":"kkcmah","id":16821647,"avatar_url":"https://avatars.githubusercontent.com/u/16821647?v=3","gravatar_id":"","url":"https://api.github.com/users/kkcmah","html_url":"https://github.com/kkcmah","followers_url":"https://api.github.com/users/kkcmah/followers","following_url":"https://api.github.com/users/kkcmah/following{/other_user}","gists_url":"https://api.github.com/users/kkcmah/gists{/gist_id}","starred_url":"https://api.github.com/users/kkcmah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kkcmah/subscriptions","organizations_url":"https://api.github.com/users/kkcmah/orgs","repos_url":"https://api.github.com/users/kkcmah/repos","events_url":"https://api.github.com/users/kkcmah/events{/privacy}","received_events_url":"https://api.github.com/users/kkcmah/received_events","type":"User","site_admin":false},"body":"To run: \r\n-make sure file paths are correct in a text file\r\n-uncomment/comment lines for desired number of programs\r\n-do ./startUp.py <text file name>\r\n","created_at":"2016-02-14T03:44:25Z","updated_at":"2016-02-19T08:10:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c8ec3fe011de3f47ff3118959c8bd188537fd05","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/1/commits","review_comments_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/1/comments","review_comment_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues/1/comments","statuses_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/statuses/9c99784ab05338ffcf3dcfe6d7a7c8ee7eefee30","head":{"label":"UCSolarCarTeam:initial","ref":"initial","sha":"9c99784ab05338ffcf3dcfe6d7a7c8ee7eefee30","user":{"login":"UCSolarCarTeam","id":14067129,"avatar_url":"https://avatars.githubusercontent.com/u/14067129?v=3","gravatar_id":"","url":"https://api.github.com/users/UCSolarCarTeam","html_url":"https://github.com/UCSolarCarTeam","followers_url":"https://api.github.com/users/UCSolarCarTeam/followers","following_url":"https://api.github.com/users/UCSolarCarTeam/following{/other_user}","gists_url":"https://api.github.com/users/UCSolarCarTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/UCSolarCarTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UCSolarCarTeam/subscriptions","organizations_url":"https://api.github.com/users/UCSolarCarTeam/orgs","repos_url":"https://api.github.com/users/UCSolarCarTeam/repos","events_url":"https://api.github.com/users/UCSolarCarTeam/events{/privacy}","received_events_url":"https://api.github.com/users/UCSolarCarTeam/received_events","type":"Organization","site_admin":false},"repo":{"id":51528804,"name":"Domovoi","full_name":"UCSolarCarTeam/Domovoi","owner":{"login":"UCSolarCarTeam","id":14067129,"avatar_url":"https://avatars.githubusercontent.com/u/14067129?v=3","gravatar_id":"","url":"https://api.github.com/users/UCSolarCarTeam","html_url":"https://github.com/UCSolarCarTeam","followers_url":"https://api.github.com/users/UCSolarCarTeam/followers","following_url":"https://api.github.com/users/UCSolarCarTeam/following{/other_user}","gists_url":"https://api.github.com/users/UCSolarCarTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/UCSolarCarTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UCSolarCarTeam/subscriptions","organizations_url":"https://api.github.com/users/UCSolarCarTeam/orgs","repos_url":"https://api.github.com/users/UCSolarCarTeam/repos","events_url":"https://api.github.com/users/UCSolarCarTeam/events{/privacy}","received_events_url":"https://api.github.com/users/UCSolarCarTeam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UCSolarCarTeam/Domovoi","description":"","fork":false,"url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi","forks_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/forks","keys_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/teams","hooks_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/hooks","issue_events_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues/events{/number}","events_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/events","assignees_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/assignees{/user}","branches_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/branches{/branch}","tags_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/tags","blobs_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/refs{/sha}","trees_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/statuses/{sha}","languages_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/languages","stargazers_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/stargazers","contributors_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/contributors","subscribers_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/subscribers","subscription_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/subscription","commits_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/commits{/sha}","git_commits_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/commits{/sha}","comments_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/comments{/number}","issue_comment_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues/comments{/number}","contents_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/contents/{+path}","compare_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/merges","archive_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/downloads","issues_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues{/number}","pulls_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls{/number}","milestones_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/milestones{/number}","notifications_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/labels{/name}","releases_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/releases{/id}","deployments_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/deployments","created_at":"2016-02-11T16:39:36Z","updated_at":"2016-02-11T16:44:44Z","pushed_at":"2016-02-14T03:44:26Z","git_url":"git://github.com/UCSolarCarTeam/Domovoi.git","ssh_url":"git@github.com:UCSolarCarTeam/Domovoi.git","clone_url":"https://github.com/UCSolarCarTeam/Domovoi.git","svn_url":"https://github.com/UCSolarCarTeam/Domovoi","homepage":null,"size":2,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"UCSolarCarTeam:master","ref":"master","sha":"1433247e1e2bc290083d9e060deef43c5548a2fd","user":{"login":"UCSolarCarTeam","id":14067129,"avatar_url":"https://avatars.githubusercontent.com/u/14067129?v=3","gravatar_id":"","url":"https://api.github.com/users/UCSolarCarTeam","html_url":"https://github.com/UCSolarCarTeam","followers_url":"https://api.github.com/users/UCSolarCarTeam/followers","following_url":"https://api.github.com/users/UCSolarCarTeam/following{/other_user}","gists_url":"https://api.github.com/users/UCSolarCarTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/UCSolarCarTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UCSolarCarTeam/subscriptions","organizations_url":"https://api.github.com/users/UCSolarCarTeam/orgs","repos_url":"https://api.github.com/users/UCSolarCarTeam/repos","events_url":"https://api.github.com/users/UCSolarCarTeam/events{/privacy}","received_events_url":"https://api.github.com/users/UCSolarCarTeam/received_events","type":"Organization","site_admin":false},"repo":{"id":51528804,"name":"Domovoi","full_name":"UCSolarCarTeam/Domovoi","owner":{"login":"UCSolarCarTeam","id":14067129,"avatar_url":"https://avatars.githubusercontent.com/u/14067129?v=3","gravatar_id":"","url":"https://api.github.com/users/UCSolarCarTeam","html_url":"https://github.com/UCSolarCarTeam","followers_url":"https://api.github.com/users/UCSolarCarTeam/followers","following_url":"https://api.github.com/users/UCSolarCarTeam/following{/other_user}","gists_url":"https://api.github.com/users/UCSolarCarTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/UCSolarCarTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UCSolarCarTeam/subscriptions","organizations_url":"https://api.github.com/users/UCSolarCarTeam/orgs","repos_url":"https://api.github.com/users/UCSolarCarTeam/repos","events_url":"https://api.github.com/users/UCSolarCarTeam/events{/privacy}","received_events_url":"https://api.github.com/users/UCSolarCarTeam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UCSolarCarTeam/Domovoi","description":"","fork":false,"url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi","forks_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/forks","keys_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/teams","hooks_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/hooks","issue_events_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues/events{/number}","events_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/events","assignees_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/assignees{/user}","branches_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/branches{/branch}","tags_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/tags","blobs_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/refs{/sha}","trees_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/statuses/{sha}","languages_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/languages","stargazers_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/stargazers","contributors_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/contributors","subscribers_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/subscribers","subscription_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/subscription","commits_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/commits{/sha}","git_commits_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/git/commits{/sha}","comments_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/comments{/number}","issue_comment_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues/comments{/number}","contents_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/contents/{+path}","compare_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/merges","archive_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/downloads","issues_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues{/number}","pulls_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls{/number}","milestones_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/milestones{/number}","notifications_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/labels{/name}","releases_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/releases{/id}","deployments_url":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/deployments","created_at":"2016-02-11T16:39:36Z","updated_at":"2016-02-11T16:44:44Z","pushed_at":"2016-02-14T03:44:26Z","git_url":"git://github.com/UCSolarCarTeam/Domovoi.git","ssh_url":"git@github.com:UCSolarCarTeam/Domovoi.git","clone_url":"https://github.com/UCSolarCarTeam/Domovoi.git","svn_url":"https://github.com/UCSolarCarTeam/Domovoi","homepage":null,"size":2,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/1"},"html":{"href":"https://github.com/UCSolarCarTeam/Domovoi/pull/1"},"issue":{"href":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues/1"},"comments":{"href":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/UCSolarCarTeam/Domovoi/statuses/9c99784ab05338ffcf3dcfe6d7a7c8ee7eefee30"}}}}