{"action":"created","comment":{"url":"https://api.github.com/repos/firewalla/firewalla/pulls/comments/141809262","pull_request_review_id":66081023,"id":141809262,"diff_hunk":"@@ -0,0 +1,67 @@\n+#!/bin/bash\n+# -----------------------------------------\n+# This is a watch dog function for fireapi.\n+# In case fireapi hangs, need to restart it.\n+# -----------------------------------------\n+\n+TOTAL_RETRIES=6\n+SLEEP_TIMEOUT=10\n+\n+IP_ADDRESS=$(ifconfig eth0|awk '/inet /{print $2}'| awk -F: '{print $2}')\n+FIREAPI_GID=$(redis-cli hget sys:ept gid)\n+FIREAPI_GROUP_MEMBER_COUNT=$(redis-cli hget sys:ept group_member_cnt)\n+FIREAPI_URL=\"http://${IP_ADDRESS}:8834/v1/encipher/message/$FIREAPI_GID\"\n+FIREAPI_REQ=$'{\n+    \"message\": {\n+        \"from\": \"Unamed\",\n+        \"obj\" : {\n+            \"mtype\": \"cmd\",\n+            \"id\": \"53D8D66E-02BC-44A7-B7C5-B7668FBCC4BA\",\n+            \"data\": {\n+                \"item\": \"ping\"\n+            },\n+            \"type\": \"jsonmsg\",\n+            \"target\": \"0.0.0.0\"\n+        },\n+        \"appInfo\": {\n+            \"appID\": \"com.rottiesoft.circle\",\n+            \"version\": \"1.18\",\n+            \"platform\": \"ios\"\n+        },\n+        \"msg\": \"\",\n+        \"type\": \"jsondata\",\n+        \"compressMode\": 1,\n+        \"mtype\": \"msg\"\n+    },\n+    \"mtype\": \"msg\"\n+}'\n+\n+fireapi_ping() {\n+    resp=$(curl -s $FIREAPI_URL \\\n+        -H 'Content-Type: application/json' \\\n+        -H 'Accept: application/json' \\\n+        --data-binary \"$FIREAPI_REQ\" \\\n+        --compressed)\n+   echo $resp | egrep -q '\"code\": *200'\n+}\n+\n+test \"$FIREAPI_GROUP_MEMBER_COUNT\" -gt 1 || exit 0\n+\n+retry=1\n+ping_ok=0\n+while (( $retry <= $TOTAL_RETRIES ))\n+do\n+    if fireapi_ping; then\n+        ping_ok=1\n+        break\n+    fi\n+    sleep $SLEEP_TIMEOUT\n+    (( retry++ ))\n+done\n+\n+if [[ $ping_ok -ne 1 ]]; then\n+    logger \"FireAPI ping FAILED, reboot now\"","path":"scripts/fireapi-ping.sh","position":63,"original_position":63,"commit_id":"fd3969627347fb51ae3912dcea1dbba4dd7cfa21","original_commit_id":"fd3969627347fb51ae3912dcea1dbba4dd7cfa21","user":{"login":"MelvinTo","id":108800,"avatar_url":"https://avatars3.githubusercontent.com/u/108800?v=4","gravatar_id":"","url":"https://api.github.com/users/MelvinTo","html_url":"https://github.com/MelvinTo","followers_url":"https://api.github.com/users/MelvinTo/followers","following_url":"https://api.github.com/users/MelvinTo/following{/other_user}","gists_url":"https://api.github.com/users/MelvinTo/gists{/gist_id}","starred_url":"https://api.github.com/users/MelvinTo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MelvinTo/subscriptions","organizations_url":"https://api.github.com/users/MelvinTo/orgs","repos_url":"https://api.github.com/users/MelvinTo/repos","events_url":"https://api.github.com/users/MelvinTo/events{/privacy}","received_events_url":"https://api.github.com/users/MelvinTo/received_events","type":"User","site_admin":false},"body":"log needs to be refined","created_at":"2017-09-29T07:55:29Z","updated_at":"2017-09-29T07:56:17Z","html_url":"https://github.com/firewalla/firewalla/pull/369#discussion_r141809262","pull_request_url":"https://api.github.com/repos/firewalla/firewalla/pulls/369","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/firewalla/firewalla/pulls/comments/141809262"},"html":{"href":"https://github.com/firewalla/firewalla/pull/369#discussion_r141809262"},"pull_request":{"href":"https://api.github.com/repos/firewalla/firewalla/pulls/369"}}},"pull_request":{"url":"https://api.github.com/repos/firewalla/firewalla/pulls/369","id":143712434,"html_url":"https://github.com/firewalla/firewalla/pull/369","diff_url":"https://github.com/firewalla/firewalla/pull/369.diff","patch_url":"https://github.com/firewalla/firewalla/pull/369.patch","issue_url":"https://api.github.com/repos/firewalla/firewalla/issues/369","number":369,"state":"open","locked":false,"title":"add fireapi-ping.sh to monitor fireapi","user":{"login":"jimyang2008","id":1947542,"avatar_url":"https://avatars1.githubusercontent.com/u/1947542?v=4","gravatar_id":"","url":"https://api.github.com/users/jimyang2008","html_url":"https://github.com/jimyang2008","followers_url":"https://api.github.com/users/jimyang2008/followers","following_url":"https://api.github.com/users/jimyang2008/following{/other_user}","gists_url":"https://api.github.com/users/jimyang2008/gists{/gist_id}","starred_url":"https://api.github.com/users/jimyang2008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimyang2008/subscriptions","organizations_url":"https://api.github.com/users/jimyang2008/orgs","repos_url":"https://api.github.com/users/jimyang2008/repos","events_url":"https://api.github.com/users/jimyang2008/events{/privacy}","received_events_url":"https://api.github.com/users/jimyang2008/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-09-28T17:44:40Z","updated_at":"2017-09-29T07:56:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3a7be1b20ae0ab408916b9c1a47c1cf5f6d15bd","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/firewalla/firewalla/pulls/369/commits","review_comments_url":"https://api.github.com/repos/firewalla/firewalla/pulls/369/comments","review_comment_url":"https://api.github.com/repos/firewalla/firewalla/pulls/comments{/number}","comments_url":"https://api.github.com/repos/firewalla/firewalla/issues/369/comments","statuses_url":"https://api.github.com/repos/firewalla/firewalla/statuses/fd3969627347fb51ae3912dcea1dbba4dd7cfa21","head":{"label":"jimyang2008:master","ref":"master","sha":"fd3969627347fb51ae3912dcea1dbba4dd7cfa21","user":{"login":"jimyang2008","id":1947542,"avatar_url":"https://avatars1.githubusercontent.com/u/1947542?v=4","gravatar_id":"","url":"https://api.github.com/users/jimyang2008","html_url":"https://github.com/jimyang2008","followers_url":"https://api.github.com/users/jimyang2008/followers","following_url":"https://api.github.com/users/jimyang2008/following{/other_user}","gists_url":"https://api.github.com/users/jimyang2008/gists{/gist_id}","starred_url":"https://api.github.com/users/jimyang2008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimyang2008/subscriptions","organizations_url":"https://api.github.com/users/jimyang2008/orgs","repos_url":"https://api.github.com/users/jimyang2008/repos","events_url":"https://api.github.com/users/jimyang2008/events{/privacy}","received_events_url":"https://api.github.com/users/jimyang2008/received_events","type":"User","site_admin":false},"repo":{"id":97927078,"name":"firewalla","full_name":"jimyang2008/firewalla","owner":{"login":"jimyang2008","id":1947542,"avatar_url":"https://avatars1.githubusercontent.com/u/1947542?v=4","gravatar_id":"","url":"https://api.github.com/users/jimyang2008","html_url":"https://github.com/jimyang2008","followers_url":"https://api.github.com/users/jimyang2008/followers","following_url":"https://api.github.com/users/jimyang2008/following{/other_user}","gists_url":"https://api.github.com/users/jimyang2008/gists{/gist_id}","starred_url":"https://api.github.com/users/jimyang2008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimyang2008/subscriptions","organizations_url":"https://api.github.com/users/jimyang2008/orgs","repos_url":"https://api.github.com/users/jimyang2008/repos","events_url":"https://api.github.com/users/jimyang2008/events{/privacy}","received_events_url":"https://api.github.com/users/jimyang2008/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jimyang2008/firewalla","description":"Firewalla ","fork":true,"url":"https://api.github.com/repos/jimyang2008/firewalla","forks_url":"https://api.github.com/repos/jimyang2008/firewalla/forks","keys_url":"https://api.github.com/repos/jimyang2008/firewalla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jimyang2008/firewalla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jimyang2008/firewalla/teams","hooks_url":"https://api.github.com/repos/jimyang2008/firewalla/hooks","issue_events_url":"https://api.github.com/repos/jimyang2008/firewalla/issues/events{/number}","events_url":"https://api.github.com/repos/jimyang2008/firewalla/events","assignees_url":"https://api.github.com/repos/jimyang2008/firewalla/assignees{/user}","branches_url":"https://api.github.com/repos/jimyang2008/firewalla/branches{/branch}","tags_url":"https://api.github.com/repos/jimyang2008/firewalla/tags","blobs_url":"https://api.github.com/repos/jimyang2008/firewalla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jimyang2008/firewalla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jimyang2008/firewalla/git/refs{/sha}","trees_url":"https://api.github.com/repos/jimyang2008/firewalla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jimyang2008/firewalla/statuses/{sha}","languages_url":"https://api.github.com/repos/jimyang2008/firewalla/languages","stargazers_url":"https://api.github.com/repos/jimyang2008/firewalla/stargazers","contributors_url":"https://api.github.com/repos/jimyang2008/firewalla/contributors","subscribers_url":"https://api.github.com/repos/jimyang2008/firewalla/subscribers","subscription_url":"https://api.github.com/repos/jimyang2008/firewalla/subscription","commits_url":"https://api.github.com/repos/jimyang2008/firewalla/commits{/sha}","git_commits_url":"https://api.github.com/repos/jimyang2008/firewalla/git/commits{/sha}","comments_url":"https://api.github.com/repos/jimyang2008/firewalla/comments{/number}","issue_comment_url":"https://api.github.com/repos/jimyang2008/firewalla/issues/comments{/number}","contents_url":"https://api.github.com/repos/jimyang2008/firewalla/contents/{+path}","compare_url":"https://api.github.com/repos/jimyang2008/firewalla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jimyang2008/firewalla/merges","archive_url":"https://api.github.com/repos/jimyang2008/firewalla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jimyang2008/firewalla/downloads","issues_url":"https://api.github.com/repos/jimyang2008/firewalla/issues{/number}","pulls_url":"https://api.github.com/repos/jimyang2008/firewalla/pulls{/number}","milestones_url":"https://api.github.com/repos/jimyang2008/firewalla/milestones{/number}","notifications_url":"https://api.github.com/repos/jimyang2008/firewalla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jimyang2008/firewalla/labels{/name}","releases_url":"https://api.github.com/repos/jimyang2008/firewalla/releases{/id}","deployments_url":"https://api.github.com/repos/jimyang2008/firewalla/deployments","created_at":"2017-07-21T08:51:16Z","updated_at":"2017-07-21T08:51:18Z","pushed_at":"2017-09-29T03:09:51Z","git_url":"git://github.com/jimyang2008/firewalla.git","ssh_url":"git@github.com:jimyang2008/firewalla.git","clone_url":"https://github.com/jimyang2008/firewalla.git","svn_url":"https://github.com/jimyang2008/firewalla","homepage":"","size":65023,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"firewalla:master","ref":"master","sha":"7c989997ce4ffe7220c22e4a81000da8d0989457","user":{"login":"firewalla","id":21322342,"avatar_url":"https://avatars0.githubusercontent.com/u/21322342?v=4","gravatar_id":"","url":"https://api.github.com/users/firewalla","html_url":"https://github.com/firewalla","followers_url":"https://api.github.com/users/firewalla/followers","following_url":"https://api.github.com/users/firewalla/following{/other_user}","gists_url":"https://api.github.com/users/firewalla/gists{/gist_id}","starred_url":"https://api.github.com/users/firewalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firewalla/subscriptions","organizations_url":"https://api.github.com/users/firewalla/orgs","repos_url":"https://api.github.com/users/firewalla/repos","events_url":"https://api.github.com/users/firewalla/events{/privacy}","received_events_url":"https://api.github.com/users/firewalla/received_events","type":"Organization","site_admin":false},"repo":{"id":67943756,"name":"firewalla","full_name":"firewalla/firewalla","owner":{"login":"firewalla","id":21322342,"avatar_url":"https://avatars0.githubusercontent.com/u/21322342?v=4","gravatar_id":"","url":"https://api.github.com/users/firewalla","html_url":"https://github.com/firewalla","followers_url":"https://api.github.com/users/firewalla/followers","following_url":"https://api.github.com/users/firewalla/following{/other_user}","gists_url":"https://api.github.com/users/firewalla/gists{/gist_id}","starred_url":"https://api.github.com/users/firewalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firewalla/subscriptions","organizations_url":"https://api.github.com/users/firewalla/orgs","repos_url":"https://api.github.com/users/firewalla/repos","events_url":"https://api.github.com/users/firewalla/events{/privacy}","received_events_url":"https://api.github.com/users/firewalla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firewalla/firewalla","description":"http://firewalla.com","fork":false,"url":"https://api.github.com/repos/firewalla/firewalla","forks_url":"https://api.github.com/repos/firewalla/firewalla/forks","keys_url":"https://api.github.com/repos/firewalla/firewalla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firewalla/firewalla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firewalla/firewalla/teams","hooks_url":"https://api.github.com/repos/firewalla/firewalla/hooks","issue_events_url":"https://api.github.com/repos/firewalla/firewalla/issues/events{/number}","events_url":"https://api.github.com/repos/firewalla/firewalla/events","assignees_url":"https://api.github.com/repos/firewalla/firewalla/assignees{/user}","branches_url":"https://api.github.com/repos/firewalla/firewalla/branches{/branch}","tags_url":"https://api.github.com/repos/firewalla/firewalla/tags","blobs_url":"https://api.github.com/repos/firewalla/firewalla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firewalla/firewalla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firewalla/firewalla/git/refs{/sha}","trees_url":"https://api.github.com/repos/firewalla/firewalla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firewalla/firewalla/statuses/{sha}","languages_url":"https://api.github.com/repos/firewalla/firewalla/languages","stargazers_url":"https://api.github.com/repos/firewalla/firewalla/stargazers","contributors_url":"https://api.github.com/repos/firewalla/firewalla/contributors","subscribers_url":"https://api.github.com/repos/firewalla/firewalla/subscribers","subscription_url":"https://api.github.com/repos/firewalla/firewalla/subscription","commits_url":"https://api.github.com/repos/firewalla/firewalla/commits{/sha}","git_commits_url":"https://api.github.com/repos/firewalla/firewalla/git/commits{/sha}","comments_url":"https://api.github.com/repos/firewalla/firewalla/comments{/number}","issue_comment_url":"https://api.github.com/repos/firewalla/firewalla/issues/comments{/number}","contents_url":"https://api.github.com/repos/firewalla/firewalla/contents/{+path}","compare_url":"https://api.github.com/repos/firewalla/firewalla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firewalla/firewalla/merges","archive_url":"https://api.github.com/repos/firewalla/firewalla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firewalla/firewalla/downloads","issues_url":"https://api.github.com/repos/firewalla/firewalla/issues{/number}","pulls_url":"https://api.github.com/repos/firewalla/firewalla/pulls{/number}","milestones_url":"https://api.github.com/repos/firewalla/firewalla/milestones{/number}","notifications_url":"https://api.github.com/repos/firewalla/firewalla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firewalla/firewalla/labels{/name}","releases_url":"https://api.github.com/repos/firewalla/firewalla/releases{/id}","deployments_url":"https://api.github.com/repos/firewalla/firewalla/deployments","created_at":"2016-09-11T17:24:15Z","updated_at":"2017-09-18T06:24:01Z","pushed_at":"2017-09-29T04:49:58Z","git_url":"git://github.com/firewalla/firewalla.git","ssh_url":"git@github.com:firewalla/firewalla.git","clone_url":"https://github.com/firewalla/firewalla.git","svn_url":"https://github.com/firewalla/firewalla","homepage":"https://forum.firewalla.com","size":65026,"stargazers_count":43,"watchers_count":43,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":84,"forks":10,"open_issues":84,"watchers":43,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/firewalla/firewalla/pulls/369"},"html":{"href":"https://github.com/firewalla/firewalla/pull/369"},"issue":{"href":"https://api.github.com/repos/firewalla/firewalla/issues/369"},"comments":{"href":"https://api.github.com/repos/firewalla/firewalla/issues/369/comments"},"review_comments":{"href":"https://api.github.com/repos/firewalla/firewalla/pulls/369/comments"},"review_comment":{"href":"https://api.github.com/repos/firewalla/firewalla/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/firewalla/firewalla/pulls/369/commits"},"statuses":{"href":"https://api.github.com/repos/firewalla/firewalla/statuses/fd3969627347fb51ae3912dcea1dbba4dd7cfa21"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"MelvinTo"}}