<?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>Jetpack Flight Log &#187; linux</title>
	<atom:link href="http://jetpackweb.com/blog/topics/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://jetpackweb.com/blog</link>
	<description>Rock{et}ing the interweb</description>
	<lastBuildDate>Wed, 19 May 2010 22:21:53 +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>Making monit, delayed_job, and bundler play nice together</title>
		<link>http://jetpackweb.com/blog/2010/05/19/making-monit-delayed_job-and-bundler-play-nice-together/</link>
		<comments>http://jetpackweb.com/blog/2010/05/19/making-monit-delayed_job-and-bundler-play-nice-together/#comments</comments>
		<pubDate>Wed, 19 May 2010 22:21:53 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[delayed_job]]></category>
		<category><![CDATA[monit]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=831</guid>
		<description><![CDATA[Recently I was having a heck of a time getting monit to start my delayed_job instances. I was using the monit template that came with delayed job, it looks something like this: check process delayed_job_bandwith_prod with pidfile /home/bandwith/apps/production/shared/pids/delayed_job.pid start program = &#34;/usr/bin/env RAILS_ENV=production /home/bandwith/apps/production/current/script/delayed_job start&#34; as uid bandwith and gid bandwith stop program = &#34;/usr/bin/env [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was having a heck of a time getting <a href="http://mmonit.com/monit/" target="_blank">monit</a> to start my <a href="http://github.com/collectiveidea/delayed_job" target="_blank">delayed_job</a> instances. I was using the monit template that came with delayed job, it looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">check process delayed_job_bandwith_prod 
  with pidfile <span class="sy0">/</span>home<span class="sy0">/</span>bandwith<span class="sy0">/</span>apps<span class="sy0">/</span>production<span class="sy0">/</span>shared<span class="sy0">/</span>pids<span class="sy0">/</span>delayed_job.pid
  start program = <span class="st0">&quot;/usr/bin/env RAILS_ENV=production /home/bandwith/apps/production/current/script/delayed_job start&quot;</span> <span class="kw2">as</span> uid bandwith and gid bandwith 
  stop program  = <span class="st0">&quot;/usr/bin/env RAILS_ENV=production /home/bandwith/apps/production/current/script/delayed_job stop&quot;</span> <span class="kw2">as</span> uid bandwith and gid bandwith</pre></div></div>

<p>This did not work however, and after quite a bit of debugging I found there are a couple of issues you might need to be aware of:</p>
<h2>1. Your $PATH</h2>
<p>monit starts things with a &#8216;<em>spartan path</em>&#8216; of:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="sy0">/</span>bin:<span class="sy0">/</span>usr<span class="sy0">/</span>bin:<span class="sy0">/</span>sbin:<span class="sy0">/</span>usr<span class="sy0">/</span>sbin</pre></div></div>

<p>My ruby happens to be in /usr/local/bin, so we will need to pass that in too:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">start program = <span class="st0">&quot;/usr/bin/env PATH=/usr/local/bin:PATH RAILS_ENV=production /var/www/apps/{app_name}/current/script/delayed_job start&quot;</span></pre></div></div>

<h2>2. monit doesn&#8217;t define a $HOME environment variable</h2>
<p>Even though we are starting these processes with uids and guids specified, that doesn&#8217;t actually load the users shell. With no $HOME env variable, <a href="http://gembundler.com/" target="_blank">bundler</a> can&#8217;t find where your gems are installed and thinks they are all missing. I ended up just putting the variable in the monit command, another option might be running <em>su -c &#8216;{command}&#8217;</em> (I didn&#8217;t test that).</p>
<p>So putting that all together you get the following which should make everything work:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">check process delayed_job_bandwith_prod 
  with pidfile <span class="sy0">/</span>home<span class="sy0">/</span>bandwith<span class="sy0">/</span>apps<span class="sy0">/</span>production<span class="sy0">/</span>shared<span class="sy0">/</span>pids<span class="sy0">/</span>delayed_job.pid
  start program = <span class="st0">&quot;/usr/bin/env HOME=/home/bandwith PATH=/usr/local/bin:<span class="es2">$PATH</span> RAILS_ENV=production /home/bandwith/apps/production/current/script/delayed_job start&quot;</span> <span class="kw2">as</span> uid bandwith and gid bandwith 
  stop program  = <span class="st0">&quot;/usr/bin/env HOME=/home/bandwith PATH=/usr/local/bin:<span class="es2">$PATH</span> RAILS_ENV=production /home/bandwith/apps/production/current/script/delayed_job stop&quot;</span> <span class="kw2">as</span> uid bandwith and gid bandwith</pre></div></div>

<p>I would be interested to know if anyone has any better suggestions, but this seems to be working nicely.</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2010/05/19/making-monit-delayed_job-and-bundler-play-nice-together/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Netopia Routers, Slow DNS, and IPv6</title>
		<link>http://jetpackweb.com/blog/2010/05/05/netopia-routers-slow-dns-and-ipv6/</link>
		<comments>http://jetpackweb.com/blog/2010/05/05/netopia-routers-slow-dns-and-ipv6/#comments</comments>
		<pubDate>Wed, 05 May 2010 18:51:34 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ipv6]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=827</guid>
		<description><![CDATA[We have been having issues for a while where DNS lookups in Ubuntu setups have been taking significant amounts of time. We learned turning off IPv6 support in Firefox would fix the issue for that application, but we needed a system wide fix. It turns out the Netopia router(3347) seems to have issues with IPv6 [...]]]></description>
			<content:encoded><![CDATA[<p>We have been having issues for a while where DNS lookups in Ubuntu setups have been taking significant amounts of time. We learned turning off IPv6 support in Firefox would fix the issue for that application, but we needed a system wide fix. </p>
<p>It turns out the Netopia router(3347) seems to have issues with IPv6 AAAA requests when acting as a DNS proxy to our ISP. Any linux computer that was getting DNS info via DHCP was generally being affected. There is no way to fix this in the Netopia web-gui, but we can telnet into the router and twiddle some things. Run the following commands once you log in:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">configure
<span class="kw1">set</span> dns proxy-enable off
save
<span class="kw3">exit</span>
restart</pre></div></div>

<p>Once the router restarts DNS look-ups will be quite snappy!</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2010/05/05/netopia-routers-slow-dns-and-ipv6/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.4 (Lucid Lynx) and Broadcom BCM4312</title>
		<link>http://jetpackweb.com/blog/2010/04/30/ubuntu-10-4-lucid-lynx-and-broadcom-bcm4312/</link>
		<comments>http://jetpackweb.com/blog/2010/04/30/ubuntu-10-4-lucid-lynx-and-broadcom-bcm4312/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 20:09:47 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[desktop]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=823</guid>
		<description><![CDATA[This is basically just a repost of the same issue I had when Karmic Koala launched Ubuntu 10.4 (Lucid Lynx) launched today and I figured it was time to do an install from scratch onto my Dell D830 Latitude laptop. Everything went quite smoothly but when it started up I noticed two issues: Problem 1: [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is basically just a repost of the same issue I had when <a href="http://jetpackweb.com/blog/2009/10/29/ubuntu-9-10-karmic-koala-and-broadcom-bcm4312/" target="_blank">Karmic Koala launched</a></em></p>
<p>Ubuntu 10.4 (Lucid Lynx) launched today and I figured it was time to do an install from scratch onto my Dell D830 Latitude laptop. Everything went quite smoothly but when it started up I noticed two issues:</p>
<p><b>Problem 1: No wireless</b></p>
<p>I know the Broadcom card inside the laptop isn&#8217;t the greatest, but the last two Ubuntu releases it has worked out of the box. The following command enabled the card after a reboot:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">apt-get</span> <span class="kw2">install</span> bcmwl-kernel-source</pre></div></div>

<p><b>Problem 2: Really slow DNS lookups (because of IPV6)</b></p>
<p>As <a href="https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/417757" target="_blank">documented on Launchpad</a>, there still doesn&#8217;t seem to be an official fix. Strangely disabling IPV6 in <i>/etc/sysctl.conf</i> didn&#8217;t solve anything, however disabling it in Firefox at least fixes the issue in the browser. Just type <b>about:config</b> in the address bar, and set <b>network.dns.disableIPv6</b> to <b>false</b>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2010/04/30/ubuntu-10-4-lucid-lynx-and-broadcom-bcm4312/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Pimp your $PS1 with source control information</title>
		<link>http://jetpackweb.com/blog/2010/01/08/pimp-your-ps1-with-source-control-information/</link>
		<comments>http://jetpackweb.com/blog/2010/01/08/pimp-your-ps1-with-source-control-information/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 02:17:09 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[cvs]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=623</guid>
		<description><![CDATA[I recently found a useful tip of appending source control information of the current working directory to your shell&#8217;s $PS1 line. It might look something like the following image: The method I saw suggested using vcprompt, a small program that outputs a short string basic version control info. Although it worked well, there were a [...]]]></description>
			<content:encoded><![CDATA[<p>I recently found a useful tip of appending source control information of the current working directory to your shell&#8217;s $PS1 line. It might look something like the following image:</p>
<p><img src="http://jetpackweb.com/blog/wp-content/uploads/2010/01/Screenshot-Terminal.png" /></p>
<p> The method I saw suggested using <a href="http://vc.gerg.ca/hg/vcprompt/" target="_blank">vcprompt</a>, a small program that outputs a short string basic version control info. Although it worked well, there were a couple issues I had with it. First, it&#8217;s subversion support was somewhat lacking. Second, it was written in C which made it more of a pain to modify, and I wasn&#8217;t a huge fan of keeping the binary in version control. </p>
<p>After a little searching I stumbled across <a href="http://github.com/xvzf/vcprompt">vcprompt.py</a>, a python script that did the same thing. This version also had wider support for source control systems, and being a standard python text script it was something I could easily modify and put into my <a href="http://github.com/anveo/dotfiles" target="_blank">dotfiles</a> git repo. I wasn&#8217;t happy with how this one displayed subversion information either(just a revision number which I didn&#8217;t find very helpful), so I <a href="http://github.com/anveo/dotfiles/blob/master/scripts/vcprompt.py" target="_blank"><strong>made my own modification</strong></a> to display the branch you are in. Please pardon my lacking Python skills. </p>
<p>Anyway, on to pimping your prompt. Before we modify the PS1 variable, we need to make sure the vcprompt.py is in your $PATH. I like to put scripts like this in a custom  <i>bin</i> directory in my homedir. One way to accomplish that might be the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">mkdir</span> <span class="re5">-p</span> ~<span class="sy0">/</span>bin
$ <span class="kw3">cd</span> ~<span class="sy0">/</span>bin
$ <span class="kw2">wget</span> http:<span class="sy0">//</span>github.com<span class="sy0">/</span>anveo<span class="sy0">/</span>dotfiles<span class="sy0">/</span>raw<span class="sy0">/</span>master<span class="sy0">/</span>scripts<span class="sy0">/</span>vcprompt.py
$ <span class="kw2">chmod</span> +x vcprompt.py
$ <span class="kw3">export</span> <span class="re2">PATH</span>=~<span class="sy0">/</span>bin:<span class="re1">$PATH</span></pre></div></div>

<p>Displayed next is the PS1 line I use &#8211; it takes up two lines: the first line contains the current user, hostname,  current working directory, and possibly version control info, and the second is just a nice looking arrow for my input. Your terminal will need to support Unicode if you want to use that symbol.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="co0"># .bashrc</span>
<span class="re2">PS1</span>=<span class="st0">&quot;<span class="es1">\n</span>\u@\h:\w \[\e[1;30m\]<span class="es4">$(vcprompt)</span>\[\e[0m\] <span class="es1">\n</span>→&quot;</span>
&nbsp;
<span class="co0"># If you are using zsh you may also need the following in .zshrc</span>
setopt prompt_subst</pre></div></div>

<p><small>If you use the colors specified, you may need to <a href="http://github.com/anveo/dotfiles/blob/master/bash/config" target="_blank">define those too</a>.</small></p>
<p>You should now have a prompt similar to the image above! For more shell customizations checkout the rest of my <a href="http://github.com/anveo/dotfiles" target="_blank">dotfiles</a>, and consider buying Peepcode&#8217;s <a href="http://peepcode.com/products/advanced-command-line" target="_blank">Advanced Command Line screencasts</a> for more productive tips!</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2010/01/08/pimp-your-ps1-with-source-control-information/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monitoring delayed_job with god on CentOS</title>
		<link>http://jetpackweb.com/blog/2009/11/02/monitoring-delayed_job-with-god-on-centos/</link>
		<comments>http://jetpackweb.com/blog/2009/11/02/monitoring-delayed_job-with-god-on-centos/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 22:24:51 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[delayed_job]]></category>
		<category><![CDATA[god]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=570</guid>
		<description><![CDATA[I recently started using god rather than monit for process monitoring. god lets me be a bit more expressive with how I want processes monitored using the the power of Ruby. The current project I am working on has a number of tasks that I want processed asynchronously so I will setup god to monitor [...]]]></description>
			<content:encoded><![CDATA[<p>I recently started using <a href="http://god.rubyforge.org/" target="_blank">god</a> rather than <a href="http://mmonit.com/monit/" target="_blank">monit</a> for process monitoring. <strong>god</strong> lets me be a bit more expressive with how I want processes monitored using the the power of Ruby.</p>
<p>The current project I am working on has a number of tasks that I want processed asynchronously so I will setup <strong>god</strong> to monitor my <a href="http://github.com/collectiveidea/delayed_job" target="_blank">delayed_jobs</a>. If you are not familiar with awesome delayed_job gem, watch the excellent <a href="http://railscasts.com/episodes/171-delayed-job" target="_blank">Railscast tutorial</a>.</p>
<p>First install the god gem:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">sudo</span> gem <span class="kw2">install</span> god</pre></div></div>

<p>Next we will create a Redhat compatible init script for god:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">sudo</span> <span class="kw2">vi</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>god
&nbsp;
<span class="co0">#!/bin/bash</span>
<span class="co0">#</span>
<span class="co0"># God</span>
<span class="co0">#</span>
<span class="co0"># chkconfig: - 85 15</span>
<span class="co0"># description: start, stop, restart God (bet you feel powerful)</span>
<span class="co0">#</span>
&nbsp;
<span class="re2">RETVAL</span>=<span class="nu0">0</span>
&nbsp;
<span class="kw1">case</span> <span class="st0">&quot;$1&quot;</span> <span class="kw1">in</span>
    start<span class="br0">&#41;</span>
      <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>god <span class="re5">-P</span> <span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>god.pid <span class="re5">-l</span> <span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>god.log
      <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>god load <span class="sy0">/</span>etc<span class="sy0">/</span>god.conf
      <span class="re2">RETVAL</span>=<span class="re4">$?</span>
      <span class="sy0">;;</span>
    stop<span class="br0">&#41;</span>
      <span class="kw2">kill</span> <span class="sy0">`</span><span class="kw2">cat</span> <span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>god.pid<span class="sy0">`</span>
      <span class="re2">RETVAL</span>=<span class="re4">$?</span>
      <span class="sy0">;;</span>
    restart<span class="br0">&#41;</span>
      <span class="kw2">kill</span> <span class="sy0">`</span><span class="kw2">cat</span> <span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>god.pid<span class="sy0">`</span>
      <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>god <span class="re5">-P</span> <span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>god.pid <span class="re5">-l</span> <span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>god.log
      <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>god load <span class="sy0">/</span>etc<span class="sy0">/</span>god.conf
      <span class="re2">RETVAL</span>=<span class="re4">$?</span>
      <span class="sy0">;;</span>
    status<span class="br0">&#41;</span>      
      <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>god status
      <span class="re2">RETVAL</span>=<span class="re4">$?</span>
      <span class="sy0">;;</span>
    <span class="sy0">*</span><span class="br0">&#41;</span>
      <span class="kw3">echo</span> <span class="st0">&quot;Usage: god {start|stop|restart|status}&quot;</span>
      <span class="kw3">exit</span> <span class="nu0">1</span>
  <span class="sy0">;;</span>
<span class="kw1">esac</span>
&nbsp;
<span class="kw3">exit</span> <span class="re1">$RETVAL</span></pre></div></div>

<h6>(adapted from debian version at <a href="http://mylescarrick.com/articles/simple_delayed_job_with_god" target="_blank">http://mylescarrick.com/articles/simple_delayed_job_with_god</a>)</h6>
<p>Now adjust the permissions, and set the init script to start on system boot:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">sudo</span> <span class="kw2">chmod</span> a+x <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>god
$ <span class="kw2">sudo</span> <span class="sy0">/</span>sbin<span class="sy0">/</span>chkconfig <span class="re5">--add</span> god
$ <span class="kw2">sudo</span> <span class="sy0">/</span>sbin<span class="sy0">/</span>chkconfig <span class="re5">--level</span> <span class="nu0">345</span> god on</pre></div></div>

<p>Before we start <strong>god</strong> up, we need to create a configuration file that tells it what configuration files to load:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family: Monaco, monospace;">$ sudo vi <span class="sy0">/</span>etc<span class="sy0">/</span>god.<span class="me1">conf</span>
&nbsp;
God.<span class="kw3">load</span> <span class="st0">&quot;/srv/apps/your_app/current/config/god/*.god&quot;</span></pre></div></div>

<p>You will need to adjust the above depending on how you have your app setup. When working in a Rails project I like to put my god scripts in <i>config/god</i>.</p>
<p>We will use <a href="http://github.com/blog/229-dj-god" target="_blank">a script</a> from the guys at github to monitor our job daemon. I tweaked it slightly to have less workers, and to set the environment properly.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family: Monaco, monospace;">RAILS_ROOT = <span class="st0">&quot;/srv/apps/your_app/current&quot;</span>
&nbsp;
1.<span class="me1">times</span> <span class="kw1">do</span> <span class="sy0">|</span>num<span class="sy0">|</span>
  God.<span class="me1">watch</span> <span class="kw1">do</span> <span class="sy0">|</span>w<span class="sy0">|</span>
    w.<span class="me1">name</span> = <span class="st0">&quot;dj-#{num}&quot;</span>
    w.<span class="me1">group</span> = <span class="st0">'dj'</span>
    w.<span class="me1">interval</span> = 30.<span class="me1">seconds</span>
    w.<span class="me1">start</span> = <span class="st0">&quot;rake -f #{RAILS_ROOT}/Rakefile RAILS_ENV=production jobs:work&quot;</span>
&nbsp;
    w.<span class="me1">uid</span> = <span class="st0">'your_app_user'</span>
    w.<span class="me1">gid</span> = <span class="st0">'your_app_user'</span>
&nbsp;
    <span class="co1"># retart if memory gets too high</span>
    w.<span class="me1">transition</span><span class="br0">&#40;</span><span class="re3">:up</span>, <span class="re3">:restart</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>on<span class="sy0">|</span>
      on.<span class="me1">condition</span><span class="br0">&#40;</span><span class="re3">:memory_usage</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>c<span class="sy0">|</span>
        c.<span class="me1">above</span> = 300.<span class="me1">megabytes</span>
        c.<span class="me1">times</span> = <span class="nu0">2</span>
      <span class="kw1">end</span>
    <span class="kw1">end</span>
&nbsp;
    <span class="co1"># determine the state on startup</span>
    w.<span class="me1">transition</span><span class="br0">&#40;</span><span class="re3">:init</span>, <span class="br0">&#123;</span> <span class="kw2">true</span> <span class="sy0">=&gt;</span> <span class="re3">:up</span>, <span class="kw2">false</span> <span class="sy0">=&gt;</span> <span class="re3">:start</span> <span class="br0">&#125;</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>on<span class="sy0">|</span>
      on.<span class="me1">condition</span><span class="br0">&#40;</span><span class="re3">:process_running</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>c<span class="sy0">|</span>
        c.<span class="me1">running</span> = <span class="kw2">true</span>
      <span class="kw1">end</span>
    <span class="kw1">end</span>
&nbsp;
    <span class="co1"># determine when process has finished starting</span>
    w.<span class="me1">transition</span><span class="br0">&#40;</span><span class="br0">&#91;</span><span class="re3">:start</span>, <span class="re3">:restart</span><span class="br0">&#93;</span>, <span class="re3">:up</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>on<span class="sy0">|</span>
      on.<span class="me1">condition</span><span class="br0">&#40;</span><span class="re3">:process_running</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>c<span class="sy0">|</span>
        c.<span class="me1">running</span> = <span class="kw2">true</span>
        c.<span class="me1">interval</span> = 5.<span class="me1">seconds</span>
      <span class="kw1">end</span>
&nbsp;
      <span class="co1"># failsafe</span>
      on.<span class="me1">condition</span><span class="br0">&#40;</span><span class="re3">:tries</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>c<span class="sy0">|</span>
        c.<span class="me1">times</span> = <span class="nu0">5</span>
        c.<span class="me1">transition</span> = <span class="re3">:start</span>
        c.<span class="me1">interval</span> = 5.<span class="me1">seconds</span>
      <span class="kw1">end</span>
    <span class="kw1">end</span>
&nbsp;
    <span class="co1"># start if process is not running</span>
    w.<span class="me1">transition</span><span class="br0">&#40;</span><span class="re3">:up</span>, <span class="re3">:start</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>on<span class="sy0">|</span>
      on.<span class="me1">condition</span><span class="br0">&#40;</span><span class="re3">:process_running</span><span class="br0">&#41;</span> <span class="kw1">do</span> <span class="sy0">|</span>c<span class="sy0">|</span>
        c.<span class="me1">running</span> = <span class="kw2">false</span>
      <span class="kw1">end</span>
    <span class="kw1">end</span>
  <span class="kw1">end</span>
<span class="kw1">end</span></pre></div></div>

<p>It&#8217;s now time to start the daemon:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">sudo</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>god start
$ <span class="kw2">sudo</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>god status
dj:
  dj-<span class="nu0">0</span>: up</pre></div></div>

<p>Looks good! If you want to make sure it&#8217;s working, kill the rake task running <strong>jobs:work</strong>. god will see that it is stopped and automatically restart it!</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/11/02/monitoring-delayed_job-with-god-on-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.10 (Karmic Koala) and Broadcom BCM4312</title>
		<link>http://jetpackweb.com/blog/2009/10/29/ubuntu-9-10-karmic-koala-and-broadcom-bcm4312/</link>
		<comments>http://jetpackweb.com/blog/2009/10/29/ubuntu-9-10-karmic-koala-and-broadcom-bcm4312/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 21:35:49 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[desktop]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[karmic]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=565</guid>
		<description><![CDATA[Ubuntu 9.10 (Karmic Koala) launched today and I figured it was time to do an install from scratch onto my Dell D830 Latitude laptop. Everything went quite smoothly but when it started up I noticed two issues: Problem 1: No wireless I know the Broadcom card inside the laptop isn&#8217;t the greatest, but the last [...]]]></description>
			<content:encoded><![CDATA[<p>Ubuntu 9.10 (Karmic Koala) launched today and I figured it was time to do an install from scratch onto my Dell D830 Latitude laptop. Everything went quite smoothly but when it started up I noticed two issues:</p>
<p><b>Problem 1: No wireless</b></p>
<p>I know the Broadcom card inside the laptop isn&#8217;t the greatest, but the last two Ubuntu releases it has worked out of the box. The following command enabled the card after a reboot:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">apt-get</span> <span class="kw2">install</span> bcmwl-kernel-source</pre></div></div>

<p><b>Problem 2: Really slow DNS lookups (because of IPV6)</b></p>
<p>As <a href="https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/417757" target="_blank">documented on Launchpad</a>, there still doesn&#8217;t seem to be an official fix. Strangely disabling IPV6 in <i>/etc/sysctl.conf</i> didn&#8217;t solve anything, however disabling it in Firefox at least fixes the issue in the browser. Just type <b>about:config</b> in the address bar, and set <b>network.dns.disableIPv6</b> to <b>false</b>.</p>
<p>Otherwise things seem to be working well, although I don&#8217;t understand why they stick with a color scheme that looks like mud.</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/10/29/ubuntu-9-10-karmic-koala-and-broadcom-bcm4312/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>pbcopy / pbpaste in Ubuntu (command line clipboard)</title>
		<link>http://jetpackweb.com/blog/2009/09/23/pbcopy-in-ubuntu-command-line-clipboard/</link>
		<comments>http://jetpackweb.com/blog/2009/09/23/pbcopy-in-ubuntu-command-line-clipboard/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 19:13:30 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[pbcopy]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=401</guid>
		<description><![CDATA[OS X has a neat command-line tool called pbcopy which takes the standard input and places it in the clipboard to paste into other applications. In Ubuntu(or any Linux distro with Xwindows), a similar tool is xclip. I like to make this alias: alias pbcopy='xclip -selection clipboard' alias pbpaste='xclip -selection clipboard -o' or the following [...]]]></description>
			<content:encoded><![CDATA[<p>OS X has a neat command-line tool called pbcopy which takes the standard input and places it in the clipboard to paste into other applications.</p>
<p>In Ubuntu(or any Linux distro with Xwindows), a similar tool is <strong>xclip</strong>. I like to make this alias:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw3">alias</span> <span class="re2">pbcopy</span>=<span class="st_h">'xclip -selection clipboard'</span>
<span class="kw3">alias</span> <span class="re2">pbpaste</span>=<span class="st_h">'xclip -selection clipboard -o'</span></pre></div></div>

<p>or the following also works if you would rather use <strong>xsel</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw3">alias</span> <span class="re2">pbcopy</span>=<span class="st_h">'xsel --clipboard --input'</span>
<span class="kw3">alias</span> <span class="re2">pbpaste</span>=<span class="st_h">'xsel --clipboard --output'</span></pre></div></div>

<p>Now you can pipe any text to <strong>pbcopy</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">cat</span> ~<span class="sy0">/</span>.ssh<span class="sy0">/</span>id_dsa.pub <span class="sy0">|</span> pbcopy</pre></div></div>

<p>Your public ssh key is transferred to your clipboard and is ready to be pasted(perhaps with pbpaste).</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/09/23/pbcopy-in-ubuntu-command-line-clipboard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Unobtrusive viewing of MySQL queries with tcpdump</title>
		<link>http://jetpackweb.com/blog/2009/09/16/unobstrusive-viewing-of-mysql-queries-with-tcpdump/</link>
		<comments>http://jetpackweb.com/blog/2009/09/16/unobstrusive-viewing-of-mysql-queries-with-tcpdump/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 17:33:32 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tcpdump]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=381</guid>
		<description><![CDATA[There are times when you need to monitor the queries coming in to MySQL, but turning on query logging would create too much of a disk I/O hit, or you can&#8217;t restart the server to setup MySQL Proxy. Instead we can just monitor the network traffic and extract data that might be interesting using tcpdump [...]]]></description>
			<content:encoded><![CDATA[<p>There are times when you need to monitor the queries coming in to MySQL, but turning on query logging would create too much of a disk I/O hit, or you can&#8217;t restart the server to setup <a href="http://forge.mysql.com/wiki/MySQL_Proxy" target="_blank">MySQL Proxy</a>. Instead we can just monitor the network traffic and extract data that might be interesting using <strong>tcpdump</strong> and an inline perl script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> tcpdump <span class="re5">-i</span> lo <span class="re5">-s</span> <span class="nu0">0</span> <span class="re5">-l</span> <span class="re5">-w</span> - dst port <span class="nu0">3306</span> <span class="sy0">|</span> <span class="kw2">strings</span> <span class="sy0">|</span> <span class="kw2">perl</span> <span class="re5">-e</span> <span class="st_h">'
while(&lt;&gt;) { chomp; next if /^[^ ]+[ ]*$/;
  if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER)/i) {
    if (defined $q) { print &quot;$q\n&quot;; }
    $q=$_;
  } else {
    $_ =~ s/^[ \t]+//; $q.=&quot; $_&quot;;
  }
}'</span></pre></div></div>

<p>This will only work for clients communicating via TCP &#8211; if you are connecting through &#8216;localhost&#8217; you will be going through a unix socket instead. If you switch &#8216;localhost&#8217; to &#8217;127.0.0.1&#8242; then your queries will go through the network stack.</p>
<p>If you just want to dump the traffic to a file for a little bit and analyze it later, do this instead:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> tcpdump <span class="re5">-i</span> lo port <span class="nu0">3306</span> <span class="re5">-s</span> <span class="nu0">65535</span> <span class="re5">-x</span> <span class="re5">-n</span> <span class="re5">-q</span> -tttt<span class="sy0">&gt;</span> tcpdump.out</pre></div></div>

<p>You can then use <strong>mk-query-digest</strong> from <a href="http://www.maatkit.org/" target="_blank">Maatkit</a> with<strong>&#8211;type=tcpdump</strong>. See more about this at the <a href="http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/" target="_blank">MySQL Performance Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/09/16/unobstrusive-viewing-of-mysql-queries-with-tcpdump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Tip: Keep track of packages you have installed</title>
		<link>http://jetpackweb.com/blog/2009/09/14/linux-tip-keep-track-of-packages-you-have-installed/</link>
		<comments>http://jetpackweb.com/blog/2009/09/14/linux-tip-keep-track-of-packages-you-have-installed/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 01:12:01 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[aptitude]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=369</guid>
		<description><![CDATA[During development on a linux system, you probably install many packages using your favorite package manager. When you have to use a new system, or reimage your current one, it can be a pain to remember all the packages you had setup. One solution is to keep a list of the packages installed after the [...]]]></description>
			<content:encoded><![CDATA[<p>During development on a linux system, you probably install many packages using your favorite package manager. When you have to use a new system, or reimage your current one, it can be a pain to remember all the packages you had setup. One solution is to keep a list of the packages installed after the OS load, and then periodically generate a list of what has been added since.</p>
<p>On a freshly installed system, create the starting baseline list of packages:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="co0"># On Debian based systems(Ubuntu):</span>
<span class="kw2">dpkg</span> <span class="re5">--get-selections</span> <span class="sy0">&gt;</span> packages-alpha.txt
&nbsp;
<span class="co0"># Or CentOS/Fedora:</span>
yum list installed <span class="sy0">&gt;</span> packages-alpha.txt</pre></div></div>

<p>You can run the command again at a later time, concatenating the output into a different file so you can view what has changed since the original system setup. Use a diff tool like diff3, vimdiff, or meld:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">meld packages-alpha.txt packages-omega.txt</pre></div></div>

<p>On Debian systems, once you have that file you can use it in a new or different system to mark packages to install using the <strong>&#8211;set-selection</strong> parameter:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">dpkg</span> <span class="re5">--set-selections</span> <span class="sy0">&lt;</span> packages-omega.txt
<span class="kw2">sudo</span> <span class="kw2">apt-get</span> upgrade</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/09/14/linux-tip-keep-track-of-packages-you-have-installed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Determining linux distribution</title>
		<link>http://jetpackweb.com/blog/2009/08/19/determining-linux-distrobution/</link>
		<comments>http://jetpackweb.com/blog/2009/08/19/determining-linux-distrobution/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 18:00:40 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=284</guid>
		<description><![CDATA[I work with a wide variety of client server deployments, and sometimes it isn&#8217;t obvious(via uname) what distribution and version a server is running. Here is a quick list of common files which contain that information: Debian /etc/debian_release, /etc/debian_version, Fedora /etc/fedora-release Gentoo /etc/gentoo-release Mandrake /etc/mandrake-release Novell SUSE /etc/SUSE-release Red Hat /etc/redhat-release, /etc/redhat_version Slackware /etc/slackware-release, /etc/slackware-version [...]]]></description>
			<content:encoded><![CDATA[<p>I work with a wide variety of client server deployments, and sometimes it isn&#8217;t obvious(via uname) what distribution and version a server is running. Here is a quick list of common files which contain that information:</p>
<pre>
Debian          /etc/debian_release, /etc/debian_version,
Fedora          /etc/fedora-release
Gentoo          /etc/gentoo-release
Mandrake        /etc/mandrake-release
Novell SUSE     /etc/SUSE-release
Red Hat         /etc/redhat-release, /etc/redhat_version
Slackware       /etc/slackware-release, /etc/slackware-version
Solaris/Sparc   /etc/release
Sun JDS         /etc/sun-release
Ubuntu          /etc/lsb-release
UnitedLinux     /etc/UnitedLinux-release
Yellow dog      /etc/yellowdog-release
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/08/19/determining-linux-distrobution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
