{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/tidb-tools/pulls/comments/86940291","pull_request_review_id":7570348,"id":86940291,"diff_hunk":"@@ -0,0 +1,271 @@\n+#!/bin/bash\n+\n+# Copyright 2016 PingCAP, Inc.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+################################################################################\n+## Colors\n+################################################################################\n+\n+RED=\"\\033[0;31m\"\n+GREEN=\"\\033[0;32m\"\n+YELLOW=\"\\033[0;33m\"\n+NC=\"\\033[0m\" # No Color\n+\n+################################################################################\n+## Utility Functions\n+################################################################################\n+echo_info () {\n+    echo -e \"${GREEN}$@${NC}\"\n+}\n+\n+echo_warning () {\n+    echo -e \"${YELLOW}$@${NC}\"\n+}\n+\n+echo_error () {\n+    echo -e \"${RED}$@${NC}\"\n+}\n+\n+\n+################################################################################\n+## Check Functions\n+################################################################################\n+\n+### Kernel\n+check_os () {\n+    local _uname_s=$(uname -s)\n+    echo -n \"${_uname_s} \"\n+    case \"${_uname_s}\" in\n+\tLinux)\n+\t    echo_info ok\n+\t    ;;\n+\tDarwin)\n+\t    echo_warning \"works, for test only\"\n+\t    echo_warning \"happy hacking!\"\n+\t    exit 1\n+\t    ;;\n+\t*BSD|CYGWIN*|Haiku|MINGW*|*)\n+\t    echo_error \"bad os\"\n+\t    echo_warning \"happy hacking!\"\n+\t    exit 1\n+\t    ;;\n+    esac\n+}\n+\n+check_kernel_arch () {\n+    local _uname_m=$(uname -m)\n+    echo -n \"${_uname_m} \"\n+    case \"${_uname_m}\" in\n+\tx86_64)\n+\t    echo_info ok\n+\t    ;;\n+\ti686)\n+\t    echo_warning works, for test only\n+\t    ;;\n+\t*)\n+\t    echo_error bad arch\n+\t    echo_warning \"happy hacking!\"\n+\t    ;;\n+    esac\n+}\n+\n+check_kernel_version () {\n+    local _uname_r=$(uname -r)\n+    echo -n \"${_uname_r} \"\n+    case \"${_uname_r}\" in\n+\t2.6.*|3.*|4.*)\n+\t    echo_info ok\n+\t    ;;\n+\t*)\n+\t    echo_warning \"unsupported version\"\n+\t    ;;\n+    esac\n+}\n+\n+## CPU\n+check_cpu () {\n+    local physicalNumber=0\n+    local coreNumber=0\n+    local logicalNumber=0\n+    local HTNumber=0\n+    _logicalNumber=$(grep \"processor\" /proc/cpuinfo|sort -u|wc -l)\n+    _physicalNumber=$(grep \"physical id\" /proc/cpuinfo|sort -u|wc -l)\n+    _coreNumber=$(grep \"cpu cores\" /proc/cpuinfo|uniq|awk -F':' '{print $2}'|xargs)\n+    _HTNumber=$((_logicalNumber / (_physicalNumber * _coreNumber)))\n+    if [ \"${_logicalNumber}\" -lt 2 -o \"${_coreNumber}\" -lt 2 ]; then\n+\techo_warning \"cpu cores are not sufficient\"\n+    else\n+\techo_info ok\n+    fi\n+    echo \"  Logical CPU Number  : ${_logicalNumber}\"\n+    echo \"  Physical CPU Number : ${_physicalNumber}\"\n+    echo \"  CPU Core Number     : ${_coreNumber}\"\n+    echo \"  HT Number           : ${_HTNumber}\"\n+    if [ \"${_HTNumber}\" -eq 1 ]; then\n+\techo_warning \"    better open HT\"\n+    fi\n+}\n+\n+## Memory\n+# >= 8G\n+check_memory_total () {\n+    local _memory_total=$(cat /proc/meminfo | grep -i MemTotal | awk '{print $2}')\n+    echo -n \"$((${_memory_total} / 1024)) MiB \"\n+    if [ \"${_memory_total}\" -lt $((1024 * 1024 * 8)) ]; then\n+\techo_warning \"not sufficient\"\n+    else","path":"scripts/checkenv.sh","position":127,"original_position":127,"commit_id":"fadc61e193ac07eb96a181a3c9f01e61f3369068","original_commit_id":"fadc61e193ac07eb96a181a3c9f01e61f3369068","user":{"login":"qiuyesuifeng","id":1953644,"avatar_url":"https://avatars.githubusercontent.com/u/1953644?v=3","gravatar_id":"","url":"https://api.github.com/users/qiuyesuifeng","html_url":"https://github.com/qiuyesuifeng","followers_url":"https://api.github.com/users/qiuyesuifeng/followers","following_url":"https://api.github.com/users/qiuyesuifeng/following{/other_user}","gists_url":"https://api.github.com/users/qiuyesuifeng/gists{/gist_id}","starred_url":"https://api.github.com/users/qiuyesuifeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qiuyesuifeng/subscriptions","organizations_url":"https://api.github.com/users/qiuyesuifeng/orgs","repos_url":"https://api.github.com/users/qiuyesuifeng/repos","events_url":"https://api.github.com/users/qiuyesuifeng/events{/privacy}","received_events_url":"https://api.github.com/users/qiuyesuifeng/received_events","type":"User","site_admin":false},"body":"If the value is very small, should we exit?","created_at":"2016-11-08T08:08:37Z","updated_at":"2016-11-08T08:11:10Z","html_url":"https://github.com/pingcap/tidb-tools/pull/27#discussion_r86940291","pull_request_url":"https://api.github.com/repos/pingcap/tidb-tools/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb-tools/pulls/comments/86940291"},"html":{"href":"https://github.com/pingcap/tidb-tools/pull/27#discussion_r86940291"},"pull_request":{"href":"https://api.github.com/repos/pingcap/tidb-tools/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/tidb-tools/pulls/27","id":92711507,"html_url":"https://github.com/pingcap/tidb-tools/pull/27","diff_url":"https://github.com/pingcap/tidb-tools/pull/27.diff","patch_url":"https://github.com/pingcap/tidb-tools/pull/27.patch","issue_url":"https://api.github.com/repos/pingcap/tidb-tools/issues/27","number":27,"state":"open","locked":false,"title":"scripts: add checkenv.sh for server environment checking","user":{"login":"andelf","id":72891,"avatar_url":"https://avatars.githubusercontent.com/u/72891?v=3","gravatar_id":"","url":"https://api.github.com/users/andelf","html_url":"https://github.com/andelf","followers_url":"https://api.github.com/users/andelf/followers","following_url":"https://api.github.com/users/andelf/following{/other_user}","gists_url":"https://api.github.com/users/andelf/gists{/gist_id}","starred_url":"https://api.github.com/users/andelf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andelf/subscriptions","organizations_url":"https://api.github.com/users/andelf/orgs","repos_url":"https://api.github.com/users/andelf/repos","events_url":"https://api.github.com/users/andelf/events{/privacy}","received_events_url":"https://api.github.com/users/andelf/received_events","type":"User","site_admin":false},"body":"- A ``checkenv.sh`` script.\r\n- Update README\r\n\r\n\r\n","created_at":"2016-11-08T03:59:26Z","updated_at":"2016-11-08T08:11:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"98fa02e17cc3e1f6b7e32f807618d6cf6e42d1c7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/tidb-tools/pulls/27/commits","review_comments_url":"https://api.github.com/repos/pingcap/tidb-tools/pulls/27/comments","review_comment_url":"https://api.github.com/repos/pingcap/tidb-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/tidb-tools/issues/27/comments","statuses_url":"https://api.github.com/repos/pingcap/tidb-tools/statuses/fadc61e193ac07eb96a181a3c9f01e61f3369068","head":{"label":"andelf:add-checkenv-scripts","ref":"add-checkenv-scripts","sha":"fadc61e193ac07eb96a181a3c9f01e61f3369068","user":{"login":"andelf","id":72891,"avatar_url":"https://avatars.githubusercontent.com/u/72891?v=3","gravatar_id":"","url":"https://api.github.com/users/andelf","html_url":"https://github.com/andelf","followers_url":"https://api.github.com/users/andelf/followers","following_url":"https://api.github.com/users/andelf/following{/other_user}","gists_url":"https://api.github.com/users/andelf/gists{/gist_id}","starred_url":"https://api.github.com/users/andelf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andelf/subscriptions","organizations_url":"https://api.github.com/users/andelf/orgs","repos_url":"https://api.github.com/users/andelf/repos","events_url":"https://api.github.com/users/andelf/events{/privacy}","received_events_url":"https://api.github.com/users/andelf/received_events","type":"User","site_admin":false},"repo":{"id":72857156,"name":"tidb-tools","full_name":"andelf/tidb-tools","owner":{"login":"andelf","id":72891,"avatar_url":"https://avatars.githubusercontent.com/u/72891?v=3","gravatar_id":"","url":"https://api.github.com/users/andelf","html_url":"https://github.com/andelf","followers_url":"https://api.github.com/users/andelf/followers","following_url":"https://api.github.com/users/andelf/following{/other_user}","gists_url":"https://api.github.com/users/andelf/gists{/gist_id}","starred_url":"https://api.github.com/users/andelf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andelf/subscriptions","organizations_url":"https://api.github.com/users/andelf/orgs","repos_url":"https://api.github.com/users/andelf/repos","events_url":"https://api.github.com/users/andelf/events{/privacy}","received_events_url":"https://api.github.com/users/andelf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andelf/tidb-tools","description":null,"fork":true,"url":"https://api.github.com/repos/andelf/tidb-tools","forks_url":"https://api.github.com/repos/andelf/tidb-tools/forks","keys_url":"https://api.github.com/repos/andelf/tidb-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andelf/tidb-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andelf/tidb-tools/teams","hooks_url":"https://api.github.com/repos/andelf/tidb-tools/hooks","issue_events_url":"https://api.github.com/repos/andelf/tidb-tools/issues/events{/number}","events_url":"https://api.github.com/repos/andelf/tidb-tools/events","assignees_url":"https://api.github.com/repos/andelf/tidb-tools/assignees{/user}","branches_url":"https://api.github.com/repos/andelf/tidb-tools/branches{/branch}","tags_url":"https://api.github.com/repos/andelf/tidb-tools/tags","blobs_url":"https://api.github.com/repos/andelf/tidb-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andelf/tidb-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andelf/tidb-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/andelf/tidb-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andelf/tidb-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/andelf/tidb-tools/languages","stargazers_url":"https://api.github.com/repos/andelf/tidb-tools/stargazers","contributors_url":"https://api.github.com/repos/andelf/tidb-tools/contributors","subscribers_url":"https://api.github.com/repos/andelf/tidb-tools/subscribers","subscription_url":"https://api.github.com/repos/andelf/tidb-tools/subscription","commits_url":"https://api.github.com/repos/andelf/tidb-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/andelf/tidb-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/andelf/tidb-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/andelf/tidb-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/andelf/tidb-tools/contents/{+path}","compare_url":"https://api.github.com/repos/andelf/tidb-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andelf/tidb-tools/merges","archive_url":"https://api.github.com/repos/andelf/tidb-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andelf/tidb-tools/downloads","issues_url":"https://api.github.com/repos/andelf/tidb-tools/issues{/number}","pulls_url":"https://api.github.com/repos/andelf/tidb-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/andelf/tidb-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/andelf/tidb-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andelf/tidb-tools/labels{/name}","releases_url":"https://api.github.com/repos/andelf/tidb-tools/releases{/id}","deployments_url":"https://api.github.com/repos/andelf/tidb-tools/deployments","created_at":"2016-11-04T14:54:36Z","updated_at":"2016-11-04T14:54:37Z","pushed_at":"2016-11-08T05:30:18Z","git_url":"git://github.com/andelf/tidb-tools.git","ssh_url":"git@github.com:andelf/tidb-tools.git","clone_url":"https://github.com/andelf/tidb-tools.git","svn_url":"https://github.com/andelf/tidb-tools","homepage":null,"size":17889,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"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":"pingcap:master","ref":"master","sha":"b4ab6d75850929558536ac39fffca9201d3eea8b","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":64638071,"name":"tidb-tools","full_name":"pingcap/tidb-tools","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/tidb-tools","description":null,"fork":false,"url":"https://api.github.com/repos/pingcap/tidb-tools","forks_url":"https://api.github.com/repos/pingcap/tidb-tools/forks","keys_url":"https://api.github.com/repos/pingcap/tidb-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tidb-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tidb-tools/teams","hooks_url":"https://api.github.com/repos/pingcap/tidb-tools/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tidb-tools/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tidb-tools/events","assignees_url":"https://api.github.com/repos/pingcap/tidb-tools/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tidb-tools/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tidb-tools/tags","blobs_url":"https://api.github.com/repos/pingcap/tidb-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tidb-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tidb-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tidb-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tidb-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tidb-tools/languages","stargazers_url":"https://api.github.com/repos/pingcap/tidb-tools/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tidb-tools/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tidb-tools/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tidb-tools/subscription","commits_url":"https://api.github.com/repos/pingcap/tidb-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tidb-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tidb-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tidb-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tidb-tools/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tidb-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tidb-tools/merges","archive_url":"https://api.github.com/repos/pingcap/tidb-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tidb-tools/downloads","issues_url":"https://api.github.com/repos/pingcap/tidb-tools/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tidb-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tidb-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tidb-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tidb-tools/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tidb-tools/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/tidb-tools/deployments","created_at":"2016-08-01T05:20:53Z","updated_at":"2016-11-04T11:33:01Z","pushed_at":"2016-11-08T05:30:18Z","git_url":"git://github.com/pingcap/tidb-tools.git","ssh_url":"git@github.com:pingcap/tidb-tools.git","clone_url":"https://github.com/pingcap/tidb-tools.git","svn_url":"https://github.com/pingcap/tidb-tools","homepage":null,"size":17907,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":7,"forks":4,"open_issues":7,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb-tools/pulls/27"},"html":{"href":"https://github.com/pingcap/tidb-tools/pull/27"},"issue":{"href":"https://api.github.com/repos/pingcap/tidb-tools/issues/27"},"comments":{"href":"https://api.github.com/repos/pingcap/tidb-tools/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/tidb-tools/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/tidb-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/tidb-tools/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/tidb-tools/statuses/fadc61e193ac07eb96a181a3c9f01e61f3369068"}}}}
{"actor":{"display_login":"qiuyesuifeng"}}