{"action":"created","comment":{"url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/comments/22542914","id":22542914,"diff_hunk":"@@ -0,0 +1,85 @@\n+#!/bin/bash\n+\n+# rdiff-backup MySQL job script for $JOB managed by Chef. Changes will be overwritten.\n+\n+# This script is normally run by cron, but can be run manually to start the job if it is not already running.\n+\n+FILE=`basename $0`\n+DIR=`dirname $0`\n+PIDFILE=\"$DIR/.$FILE.lock\"\n+JOB=\"${FILE%.sh}\"\n+LOGPATH='/var/log/rdiff-backup'\n+INSTANCES=`pgrep -fu <%= @suser %> $FILE | wc -l`\n+\n+# Prepends date to every line of stdin, then writes to both stdout and the log file.\n+function log() {\n+  sed \"s/^/[`date +'%Y-%m-%d %H:%M:%S'`] /\" | tee >(/usr/sbin/cronolog \"${LOGPATH}/${JOB}/%Y-%m.log\")\n+}\n+\n+# Prepends date to every line of stdin, then writes to stdout and both the individual and general log files.\n+function logboth() {\n+  sed \"s/^/[`date +'%Y-%m-%d %H:%M:%S'`] /\" | tee >(/usr/sbin/cronolog \"${LOGPATH}/${JOB}/%Y-%m.log\") >(/usr/sbin/cronolog \"${LOGPATH}/general/%Y-%m-%d.log\" -S \"${LOGPATH}/current.log\")\n+}\n+\n+# If we're root instead of the rdiff-backup server user, rerun the script as it.\n+if [ `whoami` = 'root' ]; then\n+  su <%= @suser %> -c $0\n+else\n+\n+  # Only run if this script isn't already running\n+  if [ $INSTANCES -lt 3 ]; then\n+    echo $$ > $PIDFILE 2> >(log)","path":"templates/default/mysql-job.sh.erb","position":31,"original_position":31,"commit_id":"c466d4d7100e9c1a6d0bffa77233ffa6414f517c","original_commit_id":"c466d4d7100e9c1a6d0bffa77233ffa6414f517c","user":{"login":"rettigs","id":5047681,"avatar_url":"https://avatars.githubusercontent.com/u/5047681?v=3","gravatar_id":"","url":"https://api.github.com/users/rettigs","html_url":"https://github.com/rettigs","followers_url":"https://api.github.com/users/rettigs/followers","following_url":"https://api.github.com/users/rettigs/following{/other_user}","gists_url":"https://api.github.com/users/rettigs/gists{/gist_id}","starred_url":"https://api.github.com/users/rettigs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rettigs/subscriptions","organizations_url":"https://api.github.com/users/rettigs/orgs","repos_url":"https://api.github.com/users/rettigs/repos","events_url":"https://api.github.com/users/rettigs/events{/privacy}","received_events_url":"https://api.github.com/users/rettigs/received_events","type":"User","site_admin":false},"body":"No, I wasn't intending to print the pid to the log, only any errors that might have occurred.  Though I don't know if that's doing anything either since I don't know that echo or > can print errors.","created_at":"2015-01-06T19:01:23Z","updated_at":"2015-01-06T19:01:23Z","html_url":"https://github.com/osuosl-cookbooks/rdiff-backup/pull/13#discussion_r22542914","pull_request_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/comments/22542914"},"html":{"href":"https://github.com/osuosl-cookbooks/rdiff-backup/pull/13#discussion_r22542914"},"pull_request":{"href":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/13","id":26339136,"html_url":"https://github.com/osuosl-cookbooks/rdiff-backup/pull/13","diff_url":"https://github.com/osuosl-cookbooks/rdiff-backup/pull/13.diff","patch_url":"https://github.com/osuosl-cookbooks/rdiff-backup/pull/13.patch","issue_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues/13","number":13,"state":"open","locked":false,"title":"MySQL database backup support","user":{"login":"rettigs","id":5047681,"avatar_url":"https://avatars.githubusercontent.com/u/5047681?v=3","gravatar_id":"","url":"https://api.github.com/users/rettigs","html_url":"https://github.com/rettigs","followers_url":"https://api.github.com/users/rettigs/followers","following_url":"https://api.github.com/users/rettigs/following{/other_user}","gists_url":"https://api.github.com/users/rettigs/gists{/gist_id}","starred_url":"https://api.github.com/users/rettigs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rettigs/subscriptions","organizations_url":"https://api.github.com/users/rettigs/orgs","repos_url":"https://api.github.com/users/rettigs/repos","events_url":"https://api.github.com/users/rettigs/events{/privacy}","received_events_url":"https://api.github.com/users/rettigs/received_events","type":"User","site_admin":false},"body":"Not currently ready, just creating the PR so comments can be made as development happens.\r\n\r\nRelevant issue: https://github.com/osuosl-cookbooks/rdiff-backup/issues/6","created_at":"2014-12-18T23:01:07Z","updated_at":"2015-01-06T19:01:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2334700d5f93bf40c8d7494a6fec56083114f74","assignee":{"login":"rettigs","id":5047681,"avatar_url":"https://avatars.githubusercontent.com/u/5047681?v=3","gravatar_id":"","url":"https://api.github.com/users/rettigs","html_url":"https://github.com/rettigs","followers_url":"https://api.github.com/users/rettigs/followers","following_url":"https://api.github.com/users/rettigs/following{/other_user}","gists_url":"https://api.github.com/users/rettigs/gists{/gist_id}","starred_url":"https://api.github.com/users/rettigs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rettigs/subscriptions","organizations_url":"https://api.github.com/users/rettigs/orgs","repos_url":"https://api.github.com/users/rettigs/repos","events_url":"https://api.github.com/users/rettigs/events{/privacy}","received_events_url":"https://api.github.com/users/rettigs/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/13/commits","review_comments_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/13/comments","review_comment_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/comments/{number}","comments_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues/13/comments","statuses_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/statuses/c466d4d7100e9c1a6d0bffa77233ffa6414f517c","head":{"label":"osuosl-cookbooks:rettigs/mysql","ref":"rettigs/mysql","sha":"c466d4d7100e9c1a6d0bffa77233ffa6414f517c","user":{"login":"osuosl-cookbooks","id":5317541,"avatar_url":"https://avatars.githubusercontent.com/u/5317541?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl-cookbooks","html_url":"https://github.com/osuosl-cookbooks","followers_url":"https://api.github.com/users/osuosl-cookbooks/followers","following_url":"https://api.github.com/users/osuosl-cookbooks/following{/other_user}","gists_url":"https://api.github.com/users/osuosl-cookbooks/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl-cookbooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl-cookbooks/subscriptions","organizations_url":"https://api.github.com/users/osuosl-cookbooks/orgs","repos_url":"https://api.github.com/users/osuosl-cookbooks/repos","events_url":"https://api.github.com/users/osuosl-cookbooks/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl-cookbooks/received_events","type":"Organization","site_admin":false},"repo":{"id":13664204,"name":"rdiff-backup","full_name":"osuosl-cookbooks/rdiff-backup","owner":{"login":"osuosl-cookbooks","id":5317541,"avatar_url":"https://avatars.githubusercontent.com/u/5317541?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl-cookbooks","html_url":"https://github.com/osuosl-cookbooks","followers_url":"https://api.github.com/users/osuosl-cookbooks/followers","following_url":"https://api.github.com/users/osuosl-cookbooks/following{/other_user}","gists_url":"https://api.github.com/users/osuosl-cookbooks/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl-cookbooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl-cookbooks/subscriptions","organizations_url":"https://api.github.com/users/osuosl-cookbooks/orgs","repos_url":"https://api.github.com/users/osuosl-cookbooks/repos","events_url":"https://api.github.com/users/osuosl-cookbooks/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl-cookbooks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/osuosl-cookbooks/rdiff-backup","description":"Chef cookbook for automating the deployment of rdiff-backup","fork":false,"url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup","forks_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/forks","keys_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/teams","hooks_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/hooks","issue_events_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues/events{/number}","events_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/events","assignees_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/assignees{/user}","branches_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/branches{/branch}","tags_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/tags","blobs_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/refs{/sha}","trees_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/statuses/{sha}","languages_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/languages","stargazers_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/stargazers","contributors_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/contributors","subscribers_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/subscribers","subscription_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/subscription","commits_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/commits{/sha}","git_commits_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/commits{/sha}","comments_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/comments{/number}","issue_comment_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues/comments/{number}","contents_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/contents/{+path}","compare_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/merges","archive_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/downloads","issues_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues{/number}","pulls_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls{/number}","milestones_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/milestones{/number}","notifications_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/labels{/name}","releases_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/releases{/id}","created_at":"2013-10-17T23:54:37Z","updated_at":"2014-12-31T01:28:06Z","pushed_at":"2015-01-06T00:39:09Z","git_url":"git://github.com/osuosl-cookbooks/rdiff-backup.git","ssh_url":"git@github.com:osuosl-cookbooks/rdiff-backup.git","clone_url":"https://github.com/osuosl-cookbooks/rdiff-backup.git","svn_url":"https://github.com/osuosl-cookbooks/rdiff-backup","homepage":"","size":968,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":15,"forks":0,"open_issues":15,"watchers":3,"default_branch":"master"}},"base":{"label":"osuosl-cookbooks:master","ref":"master","sha":"17ce26a7c7c7d49a3b2c908ca44d18ec95de8ba2","user":{"login":"osuosl-cookbooks","id":5317541,"avatar_url":"https://avatars.githubusercontent.com/u/5317541?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl-cookbooks","html_url":"https://github.com/osuosl-cookbooks","followers_url":"https://api.github.com/users/osuosl-cookbooks/followers","following_url":"https://api.github.com/users/osuosl-cookbooks/following{/other_user}","gists_url":"https://api.github.com/users/osuosl-cookbooks/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl-cookbooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl-cookbooks/subscriptions","organizations_url":"https://api.github.com/users/osuosl-cookbooks/orgs","repos_url":"https://api.github.com/users/osuosl-cookbooks/repos","events_url":"https://api.github.com/users/osuosl-cookbooks/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl-cookbooks/received_events","type":"Organization","site_admin":false},"repo":{"id":13664204,"name":"rdiff-backup","full_name":"osuosl-cookbooks/rdiff-backup","owner":{"login":"osuosl-cookbooks","id":5317541,"avatar_url":"https://avatars.githubusercontent.com/u/5317541?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl-cookbooks","html_url":"https://github.com/osuosl-cookbooks","followers_url":"https://api.github.com/users/osuosl-cookbooks/followers","following_url":"https://api.github.com/users/osuosl-cookbooks/following{/other_user}","gists_url":"https://api.github.com/users/osuosl-cookbooks/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl-cookbooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl-cookbooks/subscriptions","organizations_url":"https://api.github.com/users/osuosl-cookbooks/orgs","repos_url":"https://api.github.com/users/osuosl-cookbooks/repos","events_url":"https://api.github.com/users/osuosl-cookbooks/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl-cookbooks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/osuosl-cookbooks/rdiff-backup","description":"Chef cookbook for automating the deployment of rdiff-backup","fork":false,"url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup","forks_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/forks","keys_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/teams","hooks_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/hooks","issue_events_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues/events{/number}","events_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/events","assignees_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/assignees{/user}","branches_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/branches{/branch}","tags_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/tags","blobs_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/refs{/sha}","trees_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/statuses/{sha}","languages_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/languages","stargazers_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/stargazers","contributors_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/contributors","subscribers_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/subscribers","subscription_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/subscription","commits_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/commits{/sha}","git_commits_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/git/commits{/sha}","comments_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/comments{/number}","issue_comment_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues/comments/{number}","contents_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/contents/{+path}","compare_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/merges","archive_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/downloads","issues_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues{/number}","pulls_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls{/number}","milestones_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/milestones{/number}","notifications_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/labels{/name}","releases_url":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/releases{/id}","created_at":"2013-10-17T23:54:37Z","updated_at":"2014-12-31T01:28:06Z","pushed_at":"2015-01-06T00:39:09Z","git_url":"git://github.com/osuosl-cookbooks/rdiff-backup.git","ssh_url":"git@github.com:osuosl-cookbooks/rdiff-backup.git","clone_url":"https://github.com/osuosl-cookbooks/rdiff-backup.git","svn_url":"https://github.com/osuosl-cookbooks/rdiff-backup","homepage":"","size":968,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":15,"forks":0,"open_issues":15,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/13"},"html":{"href":"https://github.com/osuosl-cookbooks/rdiff-backup/pull/13"},"issue":{"href":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues/13"},"comments":{"href":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/osuosl-cookbooks/rdiff-backup/statuses/c466d4d7100e9c1a6d0bffa77233ffa6414f517c"}}}}