<?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; sysadmin</title>
	<atom:link href="http://jetpackweb.com/blog/topics/linux/sysadmin/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>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>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>
		<item>
		<title>Subversion repository creation script</title>
		<link>http://jetpackweb.com/blog/2009/07/22/subversion-repository-creation-script/</link>
		<comments>http://jetpackweb.com/blog/2009/07/22/subversion-repository-creation-script/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 18:12:03 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=166</guid>
		<description><![CDATA[Here is a simple script I use to create subversion repositories and setup common hook scripts. This assumes you are making svn available through an HTTPS/Apache/DAV. My directory svn structure looks like the following: $ tree -L 2 /home/svn &#160; /home/svn &#124;-- conf &#124; &#124;-- permissions.conf &#124; `-- mailer.conf &#124;-- repos &#124; &#124;-- repo1 &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a simple script I use to create subversion repositories and setup common hook scripts. This assumes you are making svn available through an HTTPS/Apache/DAV.</p>
<p>My directory svn structure looks like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">tree</span> <span class="re5">-L</span> <span class="nu0">2</span> <span class="sy0">/</span>home<span class="sy0">/</span><span class="kw2">svn</span>
&nbsp;
<span class="sy0">/</span>home<span class="sy0">/</span><span class="kw2">svn</span>
<span class="sy0">|</span>-- conf
<span class="sy0">|</span>   <span class="sy0">|</span>-- permissions.conf
<span class="sy0">|</span>   <span class="sy0">`</span>-- mailer.conf
<span class="sy0">|</span>-- repos
<span class="sy0">|</span>   <span class="sy0">|</span>-- repo1
<span class="sy0">|</span>   <span class="sy0">|</span>-- repo2
<span class="sy0">|</span>   <span class="sy0">`</span>-- repo3 
<span class="sy0">`</span>-- scripts
    <span class="sy0">|</span>-- post-commit
    <span class="sy0">|</span>-- pre-commit
    <span class="sy0">`</span>-- svncreate.sh</pre></div></div>

<p>There are 3 main directories:</p>
<p><strong>repos</strong> &#8211; This is where the actual subversion repositories are stored<br />
<strong>scripts</strong> &#8211; Various scripts, including the following creation script, and also various hook scripts that repositories can symlink to<br />
<strong>conf</strong> &#8211; Various configuration files that might contain mailer configuration or repository permissions(both outside the scope of this article)</p>
<p>The following script will create the new repository, set proper user and permissions, symlink common pre and pos commit scripts, and then make the initial import that contains the trunk/branches/tags structure.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="co0">#!/bin/bash</span>
&nbsp;
<span class="re2">REPOS_URL</span>=https:<span class="sy0">//</span>svn.example.com
<span class="re2">REPOS_PATH</span>=<span class="sy0">/</span>home<span class="sy0">/</span>svn<span class="sy0">/</span>repos
<span class="re2">SCRIPTS_PATH</span>=<span class="sy0">/</span>home<span class="sy0">/</span>svn<span class="sy0">/</span>scripts
<span class="re2">APACHE_USER</span>=www-data
&nbsp;
<span class="re2">SVNADMIN</span>=<span class="sy0">`</span><span class="kw2">which</span> <span class="kw2">svnadmin</span><span class="sy0">`</span>
<span class="re2">EXPECTED_ARGS</span>=<span class="nu0">1</span>
<span class="re2">E_BADARGS</span>=<span class="nu0">65</span>
<span class="re2">REPO</span>=$<span class="nu0">1</span>
&nbsp;
<span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re4">$#</span> <span class="re5">-ne</span> <span class="re1">$EXPECTED_ARGS</span> <span class="br0">&#93;</span>
<span class="kw1">then</span>
  <span class="kw3">echo</span> <span class="st0">&quot;Usage: $0 reponame&quot;</span>
  <span class="kw3">exit</span> <span class="re1">$E_BADARGS</span>
<span class="kw1">fi</span>
&nbsp;
<span class="re1">$SVNADMIN</span> create <span class="re5">--fs-type</span> fsfs <span class="re1">$REPOS_PATH</span><span class="sy0">/</span><span class="re1">$REPO</span>
&nbsp;
<span class="kw2">rm</span> <span class="re5">-rf</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>subversion-layout<span class="sy0">/</span>
<span class="kw2">mkdir</span> <span class="re5">-pv</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>subversion-layout<span class="sy0">/</span><span class="br0">&#123;</span>trunk,branches,tags<span class="br0">&#125;</span>
&nbsp;
<span class="kw2">ln</span> <span class="re5">-s</span> <span class="re1">$SCRIPTS_PATH</span><span class="sy0">/</span>pre-commit <span class="re1">$REPOS_PATH</span><span class="sy0">/</span>$<span class="nu0">1</span><span class="sy0">/</span>hooks<span class="sy0">/</span>pre-commit
<span class="kw2">ln</span> <span class="re5">-s</span> <span class="re1">$SCRIPTS_PATH</span><span class="sy0">/</span>post-commit <span class="re1">$REPOS_PATH</span><span class="sy0">/</span>$<span class="nu0">1</span><span class="sy0">/</span>hooks<span class="sy0">/</span>post-commit
&nbsp;
<span class="kw2">chown</span> <span class="re1">$APACHE_USER</span>:<span class="re1">$APACHE_USER</span> <span class="re5">-R</span> <span class="re1">$REPOS_PATH</span><span class="sy0">/</span>$<span class="nu0">1</span>
<span class="kw2">chmod</span> <span class="re5">-R</span> <span class="nu0">2775</span> <span class="re1">$REPOS_PATH</span><span class="sy0">/</span>$<span class="nu0">1</span>
&nbsp;
<span class="kw2">svn</span> import <span class="re5">-m</span> <span class="st0">&quot;Initial Import&quot;</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>subversion-layout<span class="sy0">/</span> <span class="re1">$REPOS_URL</span><span class="sy0">/</span><span class="re1">$REPO</span>
<span class="kw2">rm</span> <span class="re5">-rf</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>subversion-layout<span class="sy0">/</span></pre></div></div>

<p>As you root you just run it as <strong>/home/svn/scripts/svncreate.sh <i>reponame</i></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/07/22/subversion-repository-creation-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful PHP Subversion Commit Hook</title>
		<link>http://jetpackweb.com/blog/2009/07/19/useful-php-subversion-commit-hook/</link>
		<comments>http://jetpackweb.com/blog/2009/07/19/useful-php-subversion-commit-hook/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 18:02:26 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=71</guid>
		<description><![CDATA[Here is a subversion pre-commit hook script we use on PHP projects to make sure the developer making the commit is providing a meaningful description, and then PHP lint is run on each PHP script to make sure it will compile correctly. #!/bin/bash &#160; REPOS=&#34;$1&#34; TXN=&#34;$2&#34; &#160; PHP=&#34;/usr/bin/php&#34; SVNLOOK=&#34;/usr/bin/svnlook&#34; AWK=&#34;/usr/bin/awk&#34; GREP=&#34;/bin/egrep&#34; SED=&#34;/bin/sed&#34; &#160; CHANGED=`$SVNLOOK changed [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a subversion pre-commit hook script we use on PHP projects to make sure the developer making the commit is providing a meaningful description, and then PHP lint is run on each PHP script to make sure it will compile correctly.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="co0">#!/bin/bash</span>
&nbsp;
<span class="re2">REPOS</span>=<span class="st0">&quot;$1&quot;</span>
<span class="re2">TXN</span>=<span class="st0">&quot;$2&quot;</span>
&nbsp;
<span class="re2">PHP</span>=<span class="st0">&quot;/usr/bin/php&quot;</span>
<span class="re2">SVNLOOK</span>=<span class="st0">&quot;/usr/bin/svnlook&quot;</span>
<span class="re2">AWK</span>=<span class="st0">&quot;/usr/bin/awk&quot;</span>
<span class="re2">GREP</span>=<span class="st0">&quot;/bin/egrep&quot;</span>
<span class="re2">SED</span>=<span class="st0">&quot;/bin/sed&quot;</span>
&nbsp;
<span class="re2">CHANGED</span>=<span class="sy0">`</span><span class="re1">$SVNLOOK</span> changed <span class="re5">-t</span> <span class="st0">&quot;<span class="es2">$TXN</span>&quot;</span> <span class="st0">&quot;<span class="es2">$REPOS</span>&quot;</span> <span class="sy0">|</span> <span class="re1">$AWK</span> <span class="st_h">'{print $2}'</span> <span class="sy0">|</span> <span class="re1">$GREP</span> \\.php$<span class="sy0">`</span>
&nbsp;
<span class="kw1">for</span> FILE <span class="kw1">in</span> <span class="re1">$CHANGED</span>
<span class="kw1">do</span>
    <span class="re2">MESSAGE</span>=<span class="sy0">`</span><span class="re1">$SVNLOOK</span> <span class="kw2">cat</span> <span class="re5">-t</span> <span class="st0">&quot;<span class="es2">$TXN</span>&quot;</span> <span class="st0">&quot;<span class="es2">$REPOS</span>&quot;</span> <span class="st0">&quot;<span class="es2">$FILE</span>&quot;</span> <span class="sy0">|</span> <span class="re1">$PHP</span> -l<span class="sy0">`</span>
    <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re4">$?</span> <span class="re5">-ne</span> <span class="nu0">0</span> <span class="br0">&#93;</span>
    <span class="kw1">then</span>
        <span class="kw3">echo</span> <span class="nu0">1</span><span class="sy0">&gt;&amp;</span><span class="nu0">2</span>
        <span class="kw3">echo</span> <span class="st0">&quot;***********************************&quot;</span> <span class="nu0">1</span><span class="sy0">&gt;&amp;</span><span class="nu0">2</span>
        <span class="kw3">echo</span> <span class="st0">&quot;PHP error in: <span class="es2">$FILE</span>:&quot;</span> <span class="nu0">1</span><span class="sy0">&gt;&amp;</span><span class="nu0">2</span>
        <span class="kw3">echo</span> <span class="sy0">`</span><span class="kw3">echo</span> <span class="st0">&quot;<span class="es2">$MESSAGE</span>&quot;</span> <span class="sy0">|</span> <span class="re1">$SED</span> <span class="st0">&quot;s| -| <span class="es2">$FILE</span>|g&quot;</span><span class="sy0">`</span> <span class="nu0">1</span><span class="sy0">&gt;&amp;</span><span class="nu0">2</span>
        <span class="kw3">echo</span> <span class="st0">&quot;***********************************&quot;</span> <span class="nu0">1</span><span class="sy0">&gt;&amp;</span><span class="nu0">2</span>
        <span class="kw3">exit</span> <span class="nu0">1</span>
    <span class="kw1">fi</span>
<span class="kw1">done</span>
&nbsp;
<span class="co0"># Make sure that the log message contains some text.</span>
<span class="re2">SVNLOOKOK</span>=<span class="nu0">1</span>
<span class="re2">SVNLOOK</span>=<span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span><span class="kw2">svnlook</span>
<span class="re1">$SVNLOOK</span> log <span class="re5">-t</span> <span class="st0">&quot;<span class="es2">$TXN</span>&quot;</span> <span class="st0">&quot;<span class="es2">$REPOS</span>&quot;</span> <span class="sy0">|</span> \
   <span class="kw2">grep</span> <span class="st0">&quot;[a-zA-Z0-9]&quot;</span> <span class="sy0">&gt;</span> <span class="sy0">/</span>dev<span class="sy0">/</span>null <span class="sy0">||</span> <span class="re2">SVNLOOKOK</span>=<span class="nu0">0</span>
<span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re1">$SVNLOOKOK</span> = <span class="nu0">0</span> <span class="br0">&#93;</span>; <span class="kw1">then</span>
  <span class="kw3">echo</span> Empty log messages are not allowed. Please provide a proper log message. <span class="nu0">1</span><span class="sy0">&gt;&amp;</span><span class="nu0">2</span>
  <span class="kw3">exit</span> <span class="nu0">1</span>
<span class="kw1">fi</span>
&nbsp;
<span class="co0"># Make sure text might be meaningful</span>
<span class="re2">LOGMSGLEN</span>=$<span class="br0">&#40;</span><span class="re1">$SVNLOOK</span> log <span class="re5">-t</span> <span class="st0">&quot;<span class="es2">$TXN</span>&quot;</span> <span class="st0">&quot;<span class="es2">$REPOS</span>&quot;</span> <span class="sy0">|</span> <span class="kw2">grep</span> <span class="br0">&#91;</span>a-zA-Z0-<span class="nu0">9</span><span class="br0">&#93;</span> <span class="sy0">|</span> <span class="kw2">wc</span> -c<span class="br0">&#41;</span>
<span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;<span class="es2">$LOGMSGLEN</span>&quot;</span> <span class="re5">-lt</span> <span class="nu0">6</span> <span class="br0">&#93;</span>; <span class="kw1">then</span>
  <span class="kw3">echo</span> <span class="re5">-e</span> <span class="st0">&quot;Please provide a meaningful comment when committing changes.&quot;</span> <span class="nu0">1</span><span class="sy0">&gt;&amp;</span><span class="nu0">2</span>
  <span class="kw3">exit</span> <span class="nu0">1</span>
<span class="kw1">fi</span>
&nbsp;
<span class="co0"># All checks passed, so allow the commit.</span>
<span class="kw3">exit</span> <span class="nu0">0</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/07/19/useful-php-subversion-commit-hook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Linux Trick: cron  @reboot</title>
		<link>http://jetpackweb.com/blog/2009/07/17/useful-linux-trick-cron-reboot/</link>
		<comments>http://jetpackweb.com/blog/2009/07/17/useful-linux-trick-cron-reboot/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 17:19:03 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[cron]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=138</guid>
		<description><![CDATA[There are various ways to make sure something is run at system startup &#8211; Redhat has /etc/rc.local script, and it and many others have /etc/init.d/* scripts &#8211; but many times you might not have access to those files or creating init scripts might be overkill for your needs. People are always amazed when I tell [...]]]></description>
			<content:encoded><![CDATA[<p>There are various ways to make sure something is run at system startup &#8211; Redhat has <strong>/etc/rc.local</strong> script, and it and many others have <strong>/etc/init.d/*</strong> scripts &#8211; but many times you might not have access to those files or creating init scripts might be overkill for your needs.</p>
<p>People are always amazed when I tell them they can achieve this basic functionality by using cron. Many of our websites use <a href="http://sphinxsearch.com/" target="_blank">Sphinx</a>, the excellent full text indexer, to allow site searches. Should the server ever reboot, we need to make multiple search daemons start back up. Take the following line from a crontab:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">crontab <span class="re5">-l</span>
&nbsp;
<span class="sy0">@</span>reboot <span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span>searchd <span class="re5">--config</span> ~<span class="sy0">/</span>conf<span class="sy0">/</span>sphinx.conf</pre></div></div>

<p>This will make sure the <i>searchd</i> daemon starts on bootup.</p>
<p>Also there are a few other shortcuts you can use:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="sy0">@</span>yearly        Run once a year, <span class="st0">&quot;0 0 1 1 *&quot;</span>.
<span class="sy0">@</span>annually      <span class="br0">&#40;</span>same <span class="kw2">as</span> <span class="sy0">@</span>yearly<span class="br0">&#41;</span>
<span class="sy0">@</span>monthly       Run once a month, <span class="st0">&quot;0 0 1 * *&quot;</span>.
<span class="sy0">@</span>weekly        Run once a week, <span class="st0">&quot;0 0 * * 0&quot;</span>.
<span class="sy0">@</span>daily         Run once a day, <span class="st0">&quot;0 0 * * *&quot;</span>.
<span class="sy0">@</span>midnight      <span class="br0">&#40;</span>same <span class="kw2">as</span> <span class="sy0">@</span>daily<span class="br0">&#41;</span>
<span class="sy0">@</span>hourly        Run once an hour, <span class="st0">&quot;0 * * * *&quot;</span>.</pre></div></div>

<p>See <strong>man 5 cron</strong> for more information.</p>
<p>(And to be pedantic, @reboot is run when cron is started or restarted, not necessarily the OS itself. So <strong>/etc/init.d/cron restart</strong> would trigger that line to be run. You may want to keep that in mind.)</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/07/17/useful-linux-trick-cron-reboot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix Munin&#8217;s MySQL Graph on cPanel</title>
		<link>http://jetpackweb.com/blog/2009/07/16/how-to-fix-munins-mysql-graph-on-cpanel/</link>
		<comments>http://jetpackweb.com/blog/2009/07/16/how-to-fix-munins-mysql-graph-on-cpanel/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 16:54:51 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[munin]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=105</guid>
		<description><![CDATA[We have a few cPanel servers deployed and to visually monitor performance we use the Munin monitoring tool. We were having issues where the MySQL graphs would stop updating. The bug has to do with one of the perl libraries the script uses, which causes the MySQL plugin to have problems location the mysqladmin program. [...]]]></description>
			<content:encoded><![CDATA[<p>We have a few cPanel servers deployed and to visually monitor performance we use the Munin monitoring tool. We were having issues where the MySQL graphs would stop updating. The bug has to do with one of the perl libraries the script uses, which causes the MySQL plugin to have problems location the <b>mysqladmin</b> program.</p>
<p>To fix these, create or edit the following file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">vi</span> <span class="sy0">/</span>etc<span class="sy0">/</span>munin<span class="sy0">/</span>plugin-conf.d<span class="sy0">/</span>cpanel.conf</pre></div></div>

<p>It should contain the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="br0">&#91;</span>mysql<span class="sy0">*</span><span class="br0">&#93;</span>
user root
group wheel
env.mysqladmin <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>mysqladmin
env.mysqlopts <span class="re5">--defaults-extra-file</span>=<span class="sy0">/</span>root<span class="sy0">/</span>.my.cnf</pre></div></div>

<p>This would load the username and password from root&#8217;s mysql config. If that file doesn&#8217;t exist you can create it:</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>root<span class="sy0">/</span>.my.cnf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="br0">&#91;</span>client<span class="br0">&#93;</span>
<span class="re2">user</span>=<span class="st0">&quot;root&quot;</span>
<span class="re2">pass</span>=<span class="st0">&quot;secret!password&quot;</span></pre></div></div>

<p>Now just restart Munin, wait a a little bit, and the graphs should start populating again!</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>munin-node restart</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/07/16/how-to-fix-munins-mysql-graph-on-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>chkdsk and Grub</title>
		<link>http://jetpackweb.com/blog/2009/07/13/chkdsk-and-grub/</link>
		<comments>http://jetpackweb.com/blog/2009/07/13/chkdsk-and-grub/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 23:41:28 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[chkdsk]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=27</guid>
		<description><![CDATA[Recently I used GParted to resize an NTFS disk to dual boot Ubuntu and Windows XP. I finished the Ubuntu installation and everything seemed to be working fine until I tried to boot back into XP. Windows reported there might be disk corruption, ran chkdsk, and chkdsk ended up freezing. I rebooted again and saw [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I used GParted to resize an NTFS disk to dual boot Ubuntu and Windows XP. I finished the Ubuntu installation and everything seemed to be working fine until I tried to boot back into XP. Windows reported there might be disk corruption, ran chkdsk, and chkdsk ended up freezing. I rebooted again and saw that the grub bootloader was now also freezing. Delightful. Although I didn&#8217;t think chkdsk modified the MBR, upon further research in some cases it does(when run with the /r switch) and in this case ends up corrupting the MBR. To fix this issue you can perform the following:</p>
<p>Boot with an Ubuntu Live CD and open up a terminal.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> grub
&nbsp;
grub<span class="sy0">&gt;</span> <span class="kw2">find</span> <span class="sy0">/</span>boot<span class="sy0">/</span>grub<span class="sy0">/</span>stage1</pre></div></div>

<p>Note the hd<em>x</em> number and partition number to it&#8217;s right. Now type the following commands into the grub prompt:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">grub<span class="sy0">&gt;</span> root <span class="br0">&#40;</span>hdx, y<span class="br0">&#41;</span>
&nbsp;
grub<span class="sy0">&gt;</span> setup <span class="br0">&#40;</span>hdx<span class="br0">&#41;</span>
&nbsp;
grub<span class="sy0">&gt;</span> quit</pre></div></div>

<p>Note whitespace is important here. Now you can reboot. When Windows asks to run chkdsk hit a key to cancel. Once in Windows, open a command prompt and type:</p>

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

<p>This will schedule a disk check on reboot that will not alter the MBR. Reboot and allow the disk check to complete. It may automatically reboot your system again, but once that is finished both OS&#8217;s should boot fine from now on.</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/07/13/chkdsk-and-grub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
