{"action":"created","comment":{"url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/comments/26278110","id":26278110,"diff_hunk":"@@ -180,6 +219,35 @@ case \"$1\" in\n     check_container\n     docker logs dokku-mongodb | tail -n 100\n     ;;\n+  mongodb:restore) \n+    verify_min_args 2 \"$@\"\n+    check_container\n+\n+    fileOrDir=\"${3%/}\"\n+    # does file or folder exist?\n+    if [[ ! -d \"$fileOrDir\" && ! -f \"$fileOrDir\" ]]; then\n+      fail \"$fileOrDir doesn't exist\"\n+    fi\n+    \n+    if [[ $fileOrDir == *\"tar.gz\" ]]; then \n+      tempdir=\"/tmp/mongodump\"\n+      rm -rf \"$tempdir\"","path":"commands","position":93,"original_position":93,"commit_id":"48490fe94df4ced52805b21713344e98e2f616d4","original_commit_id":"48490fe94df4ced52805b21713344e98e2f616d4","user":{"login":"jeffutter","id":570037,"avatar_url":"https://avatars.githubusercontent.com/u/570037?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffutter","html_url":"https://github.com/jeffutter","followers_url":"https://api.github.com/users/jeffutter/followers","following_url":"https://api.github.com/users/jeffutter/following{/other_user}","gists_url":"https://api.github.com/users/jeffutter/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffutter/subscriptions","organizations_url":"https://api.github.com/users/jeffutter/orgs","repos_url":"https://api.github.com/users/jeffutter/repos","events_url":"https://api.github.com/users/jeffutter/events{/privacy}","received_events_url":"https://api.github.com/users/jeffutter/received_events","type":"User","site_admin":false},"body":"Maybe it would be better to have some random string (or timestamp or something) in the tmp folder name like /tmp/mongodump/date.random . The folder would need to be deleted after successful restore. My thinking behind this is - imagine if someone was simultaneously restoring from two backups at the same time (why would you do that :) .. someone would probably try it though). This would blow away the first backup mid-restore when you start the second.","created_at":"2015-03-12T04:36:47Z","updated_at":"2015-03-12T04:36:47Z","html_url":"https://github.com/jeffutter/dokku-mongodb-plugin/pull/67#discussion_r26278110","pull_request_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/comments/26278110"},"html":{"href":"https://github.com/jeffutter/dokku-mongodb-plugin/pull/67#discussion_r26278110"},"pull_request":{"href":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/67","id":30869491,"html_url":"https://github.com/jeffutter/dokku-mongodb-plugin/pull/67","diff_url":"https://github.com/jeffutter/dokku-mongodb-plugin/pull/67.diff","patch_url":"https://github.com/jeffutter/dokku-mongodb-plugin/pull/67.patch","issue_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/issues/67","number":67,"state":"open","locked":false,"title":"Added Dump and Restore-function resolves #54","user":{"login":"dj-hedgehog","id":7140800,"avatar_url":"https://avatars.githubusercontent.com/u/7140800?v=3","gravatar_id":"","url":"https://api.github.com/users/dj-hedgehog","html_url":"https://github.com/dj-hedgehog","followers_url":"https://api.github.com/users/dj-hedgehog/followers","following_url":"https://api.github.com/users/dj-hedgehog/following{/other_user}","gists_url":"https://api.github.com/users/dj-hedgehog/gists{/gist_id}","starred_url":"https://api.github.com/users/dj-hedgehog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dj-hedgehog/subscriptions","organizations_url":"https://api.github.com/users/dj-hedgehog/orgs","repos_url":"https://api.github.com/users/dj-hedgehog/repos","events_url":"https://api.github.com/users/dj-hedgehog/events{/privacy}","received_events_url":"https://api.github.com/users/dj-hedgehog/received_events","type":"User","site_admin":false},"body":"Resolves #54 ","created_at":"2015-03-10T16:51:13Z","updated_at":"2015-03-12T04:36:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6bad27c7485e104e0f89fc14bd7885e5a56242d7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/67/commits","review_comments_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/67/comments","review_comment_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/issues/67/comments","statuses_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/statuses/48490fe94df4ced52805b21713344e98e2f616d4","head":{"label":"dj-hedgehog:master","ref":"master","sha":"48490fe94df4ced52805b21713344e98e2f616d4","user":{"login":"dj-hedgehog","id":7140800,"avatar_url":"https://avatars.githubusercontent.com/u/7140800?v=3","gravatar_id":"","url":"https://api.github.com/users/dj-hedgehog","html_url":"https://github.com/dj-hedgehog","followers_url":"https://api.github.com/users/dj-hedgehog/followers","following_url":"https://api.github.com/users/dj-hedgehog/following{/other_user}","gists_url":"https://api.github.com/users/dj-hedgehog/gists{/gist_id}","starred_url":"https://api.github.com/users/dj-hedgehog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dj-hedgehog/subscriptions","organizations_url":"https://api.github.com/users/dj-hedgehog/orgs","repos_url":"https://api.github.com/users/dj-hedgehog/repos","events_url":"https://api.github.com/users/dj-hedgehog/events{/privacy}","received_events_url":"https://api.github.com/users/dj-hedgehog/received_events","type":"User","site_admin":false},"repo":{"id":31809438,"name":"dokku-mongodb-plugin","full_name":"dj-hedgehog/dokku-mongodb-plugin","owner":{"login":"dj-hedgehog","id":7140800,"avatar_url":"https://avatars.githubusercontent.com/u/7140800?v=3","gravatar_id":"","url":"https://api.github.com/users/dj-hedgehog","html_url":"https://github.com/dj-hedgehog","followers_url":"https://api.github.com/users/dj-hedgehog/followers","following_url":"https://api.github.com/users/dj-hedgehog/following{/other_user}","gists_url":"https://api.github.com/users/dj-hedgehog/gists{/gist_id}","starred_url":"https://api.github.com/users/dj-hedgehog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dj-hedgehog/subscriptions","organizations_url":"https://api.github.com/users/dj-hedgehog/orgs","repos_url":"https://api.github.com/users/dj-hedgehog/repos","events_url":"https://api.github.com/users/dj-hedgehog/events{/privacy}","received_events_url":"https://api.github.com/users/dj-hedgehog/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dj-hedgehog/dokku-mongodb-plugin","description":"Plugin to setup Mongodb accounts for containers deployed to Dokku","fork":true,"url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin","forks_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/forks","keys_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/teams","hooks_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/hooks","issue_events_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/events","assignees_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/tags","blobs_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/languages","stargazers_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/stargazers","contributors_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/contributors","subscribers_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/subscribers","subscription_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/subscription","commits_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/merges","archive_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/downloads","issues_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/labels{/name}","releases_url":"https://api.github.com/repos/dj-hedgehog/dokku-mongodb-plugin/releases{/id}","created_at":"2015-03-07T11:04:15Z","updated_at":"2015-03-12T02:57:21Z","pushed_at":"2015-03-11T12:23:53Z","git_url":"git://github.com/dj-hedgehog/dokku-mongodb-plugin.git","ssh_url":"git@github.com:dj-hedgehog/dokku-mongodb-plugin.git","clone_url":"https://github.com/dj-hedgehog/dokku-mongodb-plugin.git","svn_url":"https://github.com/dj-hedgehog/dokku-mongodb-plugin","homepage":null,"size":211,"stargazers_count":1,"watchers_count":1,"language":"Shell","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":1,"default_branch":"master"}},"base":{"label":"jeffutter:master","ref":"master","sha":"d5149f9981442d62b7a458fc2603eec70d984a93","user":{"login":"jeffutter","id":570037,"avatar_url":"https://avatars.githubusercontent.com/u/570037?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffutter","html_url":"https://github.com/jeffutter","followers_url":"https://api.github.com/users/jeffutter/followers","following_url":"https://api.github.com/users/jeffutter/following{/other_user}","gists_url":"https://api.github.com/users/jeffutter/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffutter/subscriptions","organizations_url":"https://api.github.com/users/jeffutter/orgs","repos_url":"https://api.github.com/users/jeffutter/repos","events_url":"https://api.github.com/users/jeffutter/events{/privacy}","received_events_url":"https://api.github.com/users/jeffutter/received_events","type":"User","site_admin":false},"repo":{"id":12278156,"name":"dokku-mongodb-plugin","full_name":"jeffutter/dokku-mongodb-plugin","owner":{"login":"jeffutter","id":570037,"avatar_url":"https://avatars.githubusercontent.com/u/570037?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffutter","html_url":"https://github.com/jeffutter","followers_url":"https://api.github.com/users/jeffutter/followers","following_url":"https://api.github.com/users/jeffutter/following{/other_user}","gists_url":"https://api.github.com/users/jeffutter/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffutter/subscriptions","organizations_url":"https://api.github.com/users/jeffutter/orgs","repos_url":"https://api.github.com/users/jeffutter/repos","events_url":"https://api.github.com/users/jeffutter/events{/privacy}","received_events_url":"https://api.github.com/users/jeffutter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeffutter/dokku-mongodb-plugin","description":"Plugin to setup Mongodb accounts for containers deployed to Dokku","fork":false,"url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin","forks_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/forks","keys_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/teams","hooks_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/hooks","issue_events_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/events","assignees_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/tags","blobs_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/languages","stargazers_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/stargazers","contributors_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/contributors","subscribers_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/subscribers","subscription_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/subscription","commits_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/merges","archive_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/downloads","issues_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/releases{/id}","created_at":"2013-08-21T18:35:11Z","updated_at":"2015-03-12T02:55:00Z","pushed_at":"2015-03-08T18:59:27Z","git_url":"git://github.com/jeffutter/dokku-mongodb-plugin.git","ssh_url":"git@github.com:jeffutter/dokku-mongodb-plugin.git","clone_url":"https://github.com/jeffutter/dokku-mongodb-plugin.git","svn_url":"https://github.com/jeffutter/dokku-mongodb-plugin","homepage":null,"size":603,"stargazers_count":115,"watchers_count":115,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":20,"forks":45,"open_issues":20,"watchers":115,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/67"},"html":{"href":"https://github.com/jeffutter/dokku-mongodb-plugin/pull/67"},"issue":{"href":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/issues/67"},"comments":{"href":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/jeffutter/dokku-mongodb-plugin/statuses/48490fe94df4ced52805b21713344e98e2f616d4"}}}}