<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>endot &#187; Code</title>
	<atom:link href="http://endot.org/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://endot.org</link>
	<description>random seepage from the brain of a geek</description>
	<lastBuildDate>Fri, 23 Apr 2010 04:45:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>git_backup.pl &#8211; a simple script to backup with git</title>
		<link>http://endot.org/2009/09/27/git_backup-pl-a-simple-script-to-backup-with-git/</link>
		<comments>http://endot.org/2009/09/27/git_backup-pl-a-simple-script-to-backup-with-git/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 21:24:58 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://endot.org/?p=110</guid>
		<description><![CDATA[For a while now, I&#8217;ve been backing up the few WordPress blogs that I run for various people with a very simple script that followed this algorithm: Copy files to a temporary directory. Dump the MySQL data into a file in that directory. Tarball it up. Scp that file to another server that I run. [...]]]></description>
			<content:encoded><![CDATA[<p>For a while now, I&#8217;ve been backing up the few WordPress blogs that I run for various people with a very simple script that followed this algorithm:</p>
<ol>
<li>Copy files to a temporary directory.</li>
<li>Dump the MySQL data into a file in that directory.</li>
<li>Tarball it up.</li>
<li>Scp that file to another server that I run.</li>
</ol>
<p>At the time, I did this because it was the simplest thing that could possibly work.  It didn&#8217;t depend on any external facility other than mysqldump, tar, and scp.</p>
<p>Well, running that script on a nightly cron filled up my disk allocation on that remote server a couple times, so I got clever with the backup organization so I could quickly remove old backups while keeping sparser (monthly) backups for longer.  This only helped a little, because I was still nervous about deleting backups because I didn&#8217;t know what they contained.</p>
<p>I also have been using <a href="http://git-scm.com/">git</a> more and more recently and I liked the idea of version control that can go in any direction.  So, in the spare bits of time I&#8217;ve had in the past few weeks, I wrote git_backup.pl.  It takes a git repository and does the following:</p>
<ul>
<li>git add &lt;any new or modified files&gt;</li>
<li>git rm &lt;any deleted files&gt;</li>
<li>git commit</li>
<li>git push backup</li>
</ul>
<p>Now, when the backup is run, only the small changes are sent to the remote server and I can look at the differences by examining the git log.</p>
<p>There are options for dumping database tables, changing the commit message and the remote that gets the push.  Running &#8220;git_backup.pl &#8211;man&#8221; will show all the options.</p>
<p>The source is (of course) in a git repo: http://git.endot.org/git_backup.git</p>
<p>The tree and history can be browsed at <a href="http://git.endot.org/">http://git.endot.org/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://endot.org/2009/09/27/git_backup-pl-a-simple-script-to-backup-with-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
