<?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>jonathanjulian.com &#187; UNIX</title>
	<atom:link href="http://jonathanjulian.com/category/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanjulian.com</link>
	<description>Ruby, Rails, JavaScript, software development</description>
	<lastBuildDate>Sat, 27 Feb 2010 16:59:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Backup your mysql blog with cron</title>
		<link>http://jonathanjulian.com/2009/12/backup-your-mysql-blog-with-cron/</link>
		<comments>http://jonathanjulian.com/2009/12/backup-your-mysql-blog-with-cron/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 22:46:38 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=124</guid>
		<description><![CDATA[Everyone&#8217;s tweeting about codinghorror&#8217;s data loss today. I&#8217;m not sure exactly why their hosting provider lost their blog, but I&#8217;m prepared if mine ever does. In my case, it&#8217;s easy &#8211; I email myself a dump of the WordPress mysql database nightly.
$ crontab -l
0 7 * * *  /usr/bin/mysqldump -u root -psecret --all-databases &#124;bzip2 &#62; [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_125" class="wp-caption alignnone" style="width: 539px"><img class="size-full wp-image-125" title="codinghorror" src="http://jonathanjulian.com/wp-content/uploads/2009/12/00000179.png" alt="codinghorror.com loses it's blog to a hosting failure" width="529" height="69" /><p class="wp-caption-text">codinghorror.com loses it&#39;s blog to a hosting failure</p></div>
<p>Everyone&#8217;s <a href="http://twitter.com/bryanl/statuses/6580555281">tweeting</a> about <a href="http://codinghorror.com/">codinghorror</a>&#8217;s data loss today. I&#8217;m not sure exactly why their hosting provider lost their blog, but I&#8217;m prepared if mine ever does. In my case, it&#8217;s easy &#8211; I email myself a dump of the WordPress mysql database nightly.</p>
<pre>$ crontab -l
0 7 * * *  /usr/bin/mysqldump -u root -psecret --all-databases |bzip2 &gt; /tmp/dbbackup.sql.bz &amp;&amp; (printf "\%b" "Subject: db backup for `date`\nTo: jonathan\n"; /usr/bin/uuencode /tmp/dbbackup.sql.bz all-databases.sql.bz) |/usr/sbin/ssmtp jonathan@example.com</pre>
<p>That command runs once a night, dumping the structure and contents of my mysql database, compresses it, and formats the file as an email attachment and sends it to me using <a href="http://www.linux.com/archive/feature/132006">ssmtp</a>. You can substitute sendmail, or your favorite MTA (Mail Transfer Agent).</p>
<p>Every morning, I hit &#8220;y&#8221; on that message in gmail, and that&#8217;s a fine tradeoff for sleeping soundly.</p>
<p><strong>UPDATE</strong>: the same technique can be used to backup your entire www directory, saving images and site tweaks. This cron task runs once a week, emailing my my entire WordPress install for all sites hosted on this slice.</p>
<pre>15 7 */7 * *  cd /var/www &amp;&amp; tar zcf /tmp/www.tar.gz * &amp;&amp; (printf "\%b" "Subject: www backup for `date`\nTo: jonathan\n"; /usr/bin/uuencode /tmp/www.tar.gz www.tar.gz) |/usr/sbin/ssmtp jonathan@example.com</pre>
<p>As you can imagine, the files can be uploaded to another host via scp or sent to Amazon S3 instead of emailed.</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2009/12/backup-your-mysql-blog-with-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svn revert file.rb == git checkout &#8212; file.rb</title>
		<link>http://jonathanjulian.com/2009/03/svn-revert-filerb-git-checkout-filerb/</link>
		<comments>http://jonathanjulian.com/2009/03/svn-revert-filerb-git-checkout-filerb/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 20:52:02 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[UNIX]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=37</guid>
		<description><![CDATA[You&#8217;ve changed a file, but don&#8217;t want to commit it. Ever. I do this all the time, maybe disabling a filter so I can hit a page with curl, maybe hard-coding a specific user id to test something. In subversion, you would &#8220;revert&#8221; that file.
&#60;code&#62;svn revert file.rb&#60;/code&#62;
In git, you don&#8217;t add that file to your [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;ve changed a file, but don&#8217;t want to commit it. Ever. I do this all the time, maybe disabling a filter so I can hit a page with curl, maybe hard-coding a specific user id to test something. In subversion, you would &#8220;revert&#8221; that file.</p>
<p>&lt;code&gt;svn revert file.rb&lt;/code&gt;</p>
<p>In git, you don&#8217;t add that file to your staging area for commit. To make your changes go away forever, you checkout a new copy of that file from HEAD.</p>
<p>&lt;code&gt;git checkout &#8212; file.rb&lt;/code&gt;</p>
<p>If you omit the &#8211;, it will still work, as long as you don&#8217;t have a branch named the same as your file. Thanks to <a href="http://norbauer.com/consulting/team">Jonathan Dance</a> at <a href="http://norbauer.com/notebooks/code/notes/git-revert-reset-a-single-file">norbauer.com</a> &#8211; one of the few blog entries I found describing this technique.</p>
<p><strong><em>2009-04-28 UPDATE</em></strong> &#8211; err has a great <a href="http://cheat.errtheblog.com/s/git/">git cheatsheet</a> that includes this trick under Fixing Mistakes.</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2009/03/svn-revert-filerb-git-checkout-filerb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing SNMP traps with snmptrapd</title>
		<link>http://jonathanjulian.com/2008/07/testing-snmp-traps-with-snmptrapd/</link>
		<comments>http://jonathanjulian.com/2008/07/testing-snmp-traps-with-snmptrapd/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 03:02:48 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=9</guid>
		<description><![CDATA[If you&#8217;ve never worked with SNMP, then you&#8217;re in for a treat. Get ready to party like it&#8217;s 1988, with nested authentication models, over-designed protocols, and lots of meaningless numbers. Luckily, if all you need to do is write some ruby code to send SNMP traps, you have the snmp gem to help make things [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve never worked with SNMP, then you&#8217;re in for a treat. Get ready to party like it&#8217;s 1988, with nested authentication models, over-designed protocols, and lots of meaningless numbers. Luckily, if all you need to do is write some ruby code to send SNMP traps, you have the <a href="http://snmplib.rubyforge.org/">snmp gem</a> to help make things pretty palatable.</p>
<p>So there I was, with my ruby model code happily sending out SNMP traps&#8230;.or was it? For development (and test and qa) I set up the yaml file to send SNMP traps to localhost (port 162 is the default). I just needed a way to recieve them.</p>
<p>Enter snmptrapd.</p>
<p>Yes! A command line tool to catch the traps and log them the stdout! This turned out to be pretty easy on my MacBookPro &#8211; <a href="http://www.net-snmp.org/">net-snmp</a> is already installed.</p>
<p>The hardest part is setting up the authorization model. Do this: Create a file called snmptrapd.conf in the current directory. Add the line &#8220;disableAuthorization yes&#8221; to it. Heheh. No need for security &#8211; we just want to see them.</p>
<p>Now run the snmptrapd in the foreground, logging everything to stdout:</p>
<pre>
sudo snmptrapd -f -Lo -c snmptrapd.conf
</pre>
<p>Done. Now your messages will show up in that console window. This was not as nearly as painful as I expected!</p>
<p>So in the yml file, I will configure the snmp_trap_destination to be localhost for all environments except production. If there is no daemon running, they will quietly be ignored (UDP rocks). If there is one running (debugging qa, development) then they can be logged. Life is good, even when working with a 20 year old protocol.</p>
<p>(and thanks to <a href="http://www.atlantageek.com/?p=21">atlantageek</a> for one of the only blog posts out there about snmp and ruby!)</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2008/07/testing-snmp-traps-with-snmptrapd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
