{"action":"created","comment":{"url":"https://api.github.com/repos/keybase/client/pulls/comments/65224017","id":65224017,"diff_hunk":"@@ -0,0 +1,135 @@\n+// Copyright 2015 Keybase, Inc. All rights reserved. Use of\n+// this source code is governed by the included BSD license.\n+\n+package client\n+\n+import (\n+\t\"fmt\"\n+\t\"path/filepath\"\n+\t\"time\"\n+\n+\t\"github.com/keybase/cli\"\n+\t\"github.com/keybase/client/go/install\"\n+\t\"github.com/keybase/client/go/libcmdline\"\n+\t\"github.com/keybase/client/go/libkb\"\n+\t\"github.com/keybase/go-updater/watchdog\"\n+)\n+\n+// CmdWatchdog2 defines watchdog command\n+type CmdWatchdog2 struct {\n+\tlibkb.Contextified\n+}\n+\n+// ParseArgv is args for the watchdog command\n+func (c *CmdWatchdog2) ParseArgv(ctx *cli.Context) error {\n+\treturn nil\n+}\n+\n+// Run watchdog\n+func (c *CmdWatchdog2) Run() error {\n+\tenv, log := c.G().Env, c.G().Log\n+\tlog.Info(\"Starting watchdog\")\n+\trunMode := env.GetRunMode()\n+\tif runMode != libkb.ProductionRunMode {\n+\t\treturn fmt.Errorf(\"Watchdog is only supported in production\")\n+\t}\n+\n+\t// Service\n+\tkeybasePath, err := install.BinPath()\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tserviceLogPath := filepath.Join(env.GetLogDir(), libkb.ServiceLogFileName)\n+\tserviceProgram := watchdog.Program{\n+\t\tPath: keybasePath,\n+\t\tArgs: []string{\n+\t\t\t\"-d\",\n+\t\t\t\"--log-file=\" + serviceLogPath,\n+\t\t\t\"service\",\n+\t\t\t\"--watchdog-forked\",\n+\t\t},\n+\t\tExitOn: watchdog.ExitOnSuccess,\n+\t}\n+\n+\t// KBFS\n+\tkbfsPath, err := install.KBFSBinPath(runMode, \"\")\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tmountDir, err := env.GetMountDir()\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tkbfsProgram := watchdog.Program{\n+\t\tPath: kbfsPath,\n+\t\tArgs: []string{\n+\t\t\t\"-debug\",\n+\t\t\t\"-log-to-file\",\n+\t\t\tmountDir,\n+\t\t},\n+\t}\n+\n+\t// Updater\n+\tupdaterPath, err := install.UpdaterBinPath()\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tupdaterProgram := watchdog.Program{\n+\t\tPath: updaterPath,\n+\t\tArgs: []string{\n+\t\t\t\"-path-to-keybase=\" + keybasePath,\n+\t\t},\n+\t}\n+\n+\t// Start and monitor all the programs\n+\tprograms := []watchdog.Program{\n+\t\tserviceProgram,\n+\t\tkbfsProgram,\n+\t\tupdaterProgram,\n+\t}\n+\tif err := watchdog.Watch(programs, 10*time.Second, c); err != nil {\n+\t\treturn err\n+\t}\n+\n+\tfor {\n+\t\ttime.Sleep(time.Hour)","path":"go/client/cmd_ctl_watchdog2.go","position":95,"original_position":95,"commit_id":"2ff177adbebaa3f8e1999992ba2660693e92586a","original_commit_id":"2ff177adbebaa3f8e1999992ba2660693e92586a","user":{"login":"gabriel","id":2669,"avatar_url":"https://avatars.githubusercontent.com/u/2669?v=3","gravatar_id":"","url":"https://api.github.com/users/gabriel","html_url":"https://github.com/gabriel","followers_url":"https://api.github.com/users/gabriel/followers","following_url":"https://api.github.com/users/gabriel/following{/other_user}","gists_url":"https://api.github.com/users/gabriel/gists{/gist_id}","starred_url":"https://api.github.com/users/gabriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabriel/subscriptions","organizations_url":"https://api.github.com/users/gabriel/orgs","repos_url":"https://api.github.com/users/gabriel/repos","events_url":"https://api.github.com/users/gabriel/events{/privacy}","received_events_url":"https://api.github.com/users/gabriel/received_events","type":"User","site_admin":false},"body":"This is a wait forever since `watchdog.Watch` is non-blocking... we can change to `select{}` which also does a wait forever in go without sleep","created_at":"2016-05-31T17:13:01Z","updated_at":"2016-05-31T17:13:01Z","html_url":"https://github.com/keybase/client/pull/2899#discussion_r65224017","pull_request_url":"https://api.github.com/repos/keybase/client/pulls/2899","_links":{"self":{"href":"https://api.github.com/repos/keybase/client/pulls/comments/65224017"},"html":{"href":"https://github.com/keybase/client/pull/2899#discussion_r65224017"},"pull_request":{"href":"https://api.github.com/repos/keybase/client/pulls/2899"}}},"pull_request":{"url":"https://api.github.com/repos/keybase/client/pulls/2899","id":71459785,"html_url":"https://github.com/keybase/client/pull/2899","diff_url":"https://github.com/keybase/client/pull/2899.diff","patch_url":"https://github.com/keybase/client/pull/2899.patch","issue_url":"https://api.github.com/repos/keybase/client/issues/2899","number":2899,"state":"open","locked":false,"title":"Watchdog (v2)","user":{"login":"gabriel","id":2669,"avatar_url":"https://avatars.githubusercontent.com/u/2669?v=3","gravatar_id":"","url":"https://api.github.com/users/gabriel","html_url":"https://github.com/gabriel","followers_url":"https://api.github.com/users/gabriel/followers","following_url":"https://api.github.com/users/gabriel/following{/other_user}","gists_url":"https://api.github.com/users/gabriel/gists{/gist_id}","starred_url":"https://api.github.com/users/gabriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabriel/subscriptions","organizations_url":"https://api.github.com/users/gabriel/orgs","repos_url":"https://api.github.com/users/gabriel/repos","events_url":"https://api.github.com/users/gabriel/events{/privacy}","received_events_url":"https://api.github.com/users/gabriel/received_events","type":"User","site_admin":false},"body":"Designed to work on all platforms.\r\nSee https://github.com/keybase/go-updater/pull/78 for more details.\r\n\r\nIt will be `ctl watchdog2` until we flip it on.\r\n\r\nThis PR also tweaks the install package:\r\n- GetMountDir can return an error (if unsupported)\r\n- KBFSBinPath is now public method\r\n- Unified defaultLinkPath method (was dupe code)\r\n- BinPath is now public method\r\n- Added UpdaterBinPath for path to updater executable\r\n- kbfsBinName moved to separate file\r\n\r\nIgnore CI failures since this doesn't have packages vendored. I will create separate PR for that since it will make it harder to evaluate.","created_at":"2016-05-25T20:43:40Z","updated_at":"2016-05-31T17:13:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d931f233fe5ae7f270b63532976266503dcf0be2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/keybase/client/pulls/2899/commits","review_comments_url":"https://api.github.com/repos/keybase/client/pulls/2899/comments","review_comment_url":"https://api.github.com/repos/keybase/client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keybase/client/issues/2899/comments","statuses_url":"https://api.github.com/repos/keybase/client/statuses/2ff177adbebaa3f8e1999992ba2660693e92586a","head":{"label":"keybase:watchdogv2","ref":"watchdogv2","sha":"2ff177adbebaa3f8e1999992ba2660693e92586a","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":29099181,"name":"client","full_name":"keybase/client","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/client","description":"Keybase Go Library, Client, Service, OS X, iOS, Android, Electron","fork":false,"url":"https://api.github.com/repos/keybase/client","forks_url":"https://api.github.com/repos/keybase/client/forks","keys_url":"https://api.github.com/repos/keybase/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/client/teams","hooks_url":"https://api.github.com/repos/keybase/client/hooks","issue_events_url":"https://api.github.com/repos/keybase/client/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/client/events","assignees_url":"https://api.github.com/repos/keybase/client/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/client/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/client/tags","blobs_url":"https://api.github.com/repos/keybase/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/client/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/client/languages","stargazers_url":"https://api.github.com/repos/keybase/client/stargazers","contributors_url":"https://api.github.com/repos/keybase/client/contributors","subscribers_url":"https://api.github.com/repos/keybase/client/subscribers","subscription_url":"https://api.github.com/repos/keybase/client/subscription","commits_url":"https://api.github.com/repos/keybase/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/client/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/client/merges","archive_url":"https://api.github.com/repos/keybase/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/client/downloads","issues_url":"https://api.github.com/repos/keybase/client/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/client/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/client/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/client/labels{/name}","releases_url":"https://api.github.com/repos/keybase/client/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/client/deployments","created_at":"2015-01-11T17:17:12Z","updated_at":"2016-05-31T15:06:37Z","pushed_at":"2016-05-31T17:08:42Z","git_url":"git://github.com/keybase/client.git","ssh_url":"git@github.com:keybase/client.git","clone_url":"https://github.com/keybase/client.git","svn_url":"https://github.com/keybase/client","homepage":"","size":151532,"stargazers_count":512,"watchers_count":512,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":204,"forks":39,"open_issues":204,"watchers":512,"default_branch":"master"}},"base":{"label":"keybase:master","ref":"master","sha":"0fff06e04de8828ac62d5769c30dce6ed1209235","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":29099181,"name":"client","full_name":"keybase/client","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/client","description":"Keybase Go Library, Client, Service, OS X, iOS, Android, Electron","fork":false,"url":"https://api.github.com/repos/keybase/client","forks_url":"https://api.github.com/repos/keybase/client/forks","keys_url":"https://api.github.com/repos/keybase/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/client/teams","hooks_url":"https://api.github.com/repos/keybase/client/hooks","issue_events_url":"https://api.github.com/repos/keybase/client/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/client/events","assignees_url":"https://api.github.com/repos/keybase/client/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/client/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/client/tags","blobs_url":"https://api.github.com/repos/keybase/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/client/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/client/languages","stargazers_url":"https://api.github.com/repos/keybase/client/stargazers","contributors_url":"https://api.github.com/repos/keybase/client/contributors","subscribers_url":"https://api.github.com/repos/keybase/client/subscribers","subscription_url":"https://api.github.com/repos/keybase/client/subscription","commits_url":"https://api.github.com/repos/keybase/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/client/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/client/merges","archive_url":"https://api.github.com/repos/keybase/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/client/downloads","issues_url":"https://api.github.com/repos/keybase/client/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/client/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/client/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/client/labels{/name}","releases_url":"https://api.github.com/repos/keybase/client/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/client/deployments","created_at":"2015-01-11T17:17:12Z","updated_at":"2016-05-31T15:06:37Z","pushed_at":"2016-05-31T17:08:42Z","git_url":"git://github.com/keybase/client.git","ssh_url":"git@github.com:keybase/client.git","clone_url":"https://github.com/keybase/client.git","svn_url":"https://github.com/keybase/client","homepage":"","size":151532,"stargazers_count":512,"watchers_count":512,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":204,"forks":39,"open_issues":204,"watchers":512,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keybase/client/pulls/2899"},"html":{"href":"https://github.com/keybase/client/pull/2899"},"issue":{"href":"https://api.github.com/repos/keybase/client/issues/2899"},"comments":{"href":"https://api.github.com/repos/keybase/client/issues/2899/comments"},"review_comments":{"href":"https://api.github.com/repos/keybase/client/pulls/2899/comments"},"review_comment":{"href":"https://api.github.com/repos/keybase/client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keybase/client/pulls/2899/commits"},"statuses":{"href":"https://api.github.com/repos/keybase/client/statuses/2ff177adbebaa3f8e1999992ba2660693e92586a"}}}}
{"actor":{"display_login":"gabriel"}}