<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3238679741398030872</id><updated>2011-11-27T15:46:43.466-08:00</updated><category term='scripting'/><category term='awk bash shell'/><category term='php'/><category term='books'/><category term='debian ubuntu dpkg'/><category term='storage'/><category term='gotchas'/><category term='sed bash shell'/><category term='mail relay exim'/><category term='ubuntu iphone tethering'/><category term='monitoring zenoss error'/><category term='exclude'/><category term='bash shell'/><category term='iostat'/><category term='troubleshooting'/><category term='find'/><category term='ssl file encryption unix shell'/><category term='shell'/><category term='netapp'/><category term='iops'/><category term='exim swatch'/><category term='symfony'/><category term='ec2 tools cli'/><category term='ssh osx'/><category term='vmstat'/><title type='text'>Better Living Through Unix</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-2946257366268512313</id><published>2011-05-30T07:07:00.000-07:00</published><updated>2011-05-30T07:50:53.963-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='symfony'/><category scheme='http://www.blogger.com/atom/ns#' term='gotchas'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Symfony Deployment Gotcha</title><content type='html'>So I've been working with Symfony in the PHP arena and I found a really obnoxious gotcha that lives at the intersection of Symfony-based tutorials and Redhad-based distros.  (In this case, CentOS.)&lt;br /&gt;&lt;br /&gt;Namely, Symfony creates a rather expansive directory structure that - for security reasons - can't all live under your web root.  The solution all the tutorials have you do is to set up the actual project in your home directory and then create an Apache virtual server that points to it.  Seems simple enough.  And you can add it to your config without any griping from Apache.  Symfony has all the global perms set, so you're good, right?&lt;br /&gt;&lt;br /&gt;Wrong, unfortunately.  I was getting "403 Forbidden" over and over.  I tried a wide variety of fixes, none of which worked.  Eventually, I found this post on google groups:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;http://bit.ly/mNRrlV  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sure enough, I checked the root perms of my home directory and it was all tightened down:&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;drwx------ 17 user user 4096 May 30 06:16 user&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just goes to show you the danger of returning to "childlike innonence" with new projects.&lt;br /&gt;&lt;br /&gt;In reality, the right way to approach this is to create a project-specific directory somewhere under /usr/local and consciously set perms for the whole thing.&lt;br /&gt;&lt;br /&gt;Following that approach, you get the right results straight out of the gate:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;[root@localhost local]# ls -ld projects/&lt;/span&gt; &lt;span style=";font-family:courier new;font-size:85%;"  &gt;&lt;br /&gt;drwxr-xr-x 3 root root 4096 May 30 07:17 projects/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;[root@localhost local]# ls -ld projects/milkshake/&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;drwxr-xr-x 11 root root 4096 May 30 07:18 projects/milkshake/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, you create your Symfony project under that:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;symfony generate:project --orm=Propel milkshake&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And your app:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;symfony generate:app frontend&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Finally, you add the following to your httpd.conf:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;# Be sure to only have this line once in your configuration&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;NameVirtualHost *:8080&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;# This is the configuration for your project&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;Listen *:8080&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;VirtualHost *:8080&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  DocumentRoot "/usr/local/projects/milkshake/web"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;DirectoryIndex index.php&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&amp;lt;Directory "/usr/local/projects/milkshake/web"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  AllowOverride All&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  Allow from All&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&amp;lt;/Directory&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:georgia;"&gt;This is a good lesson for everybody:  please check what you write and all your other assumptions, as well.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-2946257366268512313?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/2946257366268512313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/05/symfony-deployment-gotcha.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/2946257366268512313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/2946257366268512313'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/05/symfony-deployment-gotcha.html' title='Symfony Deployment Gotcha'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-6332826147328251006</id><published>2011-02-25T09:53:00.001-08:00</published><updated>2011-02-25T09:56:25.322-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exim swatch'/><title type='text'>swatch queues messages</title><content type='html'>Swatch is a fantastic tool for tailing logs for errors.  But it has a surprising built-in behavior:  it forcefully queues the outbound mails it generates for 30 minutes.  Obviously, this stuff can be time-sensitive.  I bugged some enlightened folks on the IRC channel and I got this excellent suggestion:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Create a job in root's cron to have exim flush the queue for the destionation mail addy at whatever interval you want.  Here's one that does it every five minutes:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;*/5 * * * * /usr/sbin/exim -qR&lt;address&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This solution is particularly elegant because you don't need to dig around inside swatch's guts.  (Something you should never do with a package for a whole host of reasons.)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-6332826147328251006?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/6332826147328251006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/02/swatch-queues-messages.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6332826147328251006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6332826147328251006'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/02/swatch-queues-messages.html' title='swatch queues messages'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-9019201321007001852</id><published>2011-01-28T11:19:00.000-08:00</published><updated>2011-01-28T11:28:00.187-08:00</updated><title type='text'>Make your own daemon</title><content type='html'>A fantastic article on swatch (http://www.linux-mag.com/id/7807) included this delightfully simple framework for rolling your own daemons. If you take a moment to read it, you'll see a lot of unix design principles relating in perfect harmony:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;#!/bin/sh &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;# Simple Log Watcher Program  &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;case "$1" in 'start')   &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;/usr/bin/swatch --daemon --config-file=/etc/swatch.conf --tail-file=/var/log/auth.log --pid-file=/var/run/swatch.pid   &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;;; &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;'stop')   PID=`cat /var/run/swatch.pid`   kill $PID   &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;;; &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;*)   echo "Usage: $0 { start | stop }   &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;;; &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;esac &lt;/span&gt;&lt;/pre&gt;&lt;pre class="WonB"&gt;&lt;span class="Apple-style-span"&gt;exit 0&lt;/span&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-9019201321007001852?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/9019201321007001852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/01/make-your-own-daemon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/9019201321007001852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/9019201321007001852'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/01/make-your-own-daemon.html' title='Make your own daemon'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-4190435660448930786</id><published>2011-01-27T18:06:00.000-08:00</published><updated>2011-01-27T18:07:40.916-08:00</updated><title type='text'>Unattended Ubuntu Apt Installs</title><content type='html'>This will be short and sweet.&lt;br /&gt;&lt;br /&gt;When you want to&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;apt-get install package&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and you don't want to get prompted for values, etc, just add the following the front of your shell:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;export DEBIAN_FRONTEND=noninteractive&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Poof.  Magic.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-4190435660448930786?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/4190435660448930786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/01/unattended-ubuntu-apt-installs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4190435660448930786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4190435660448930786'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/01/unattended-ubuntu-apt-installs.html' title='Unattended Ubuntu Apt Installs'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-3941096387491903865</id><published>2011-01-02T10:54:00.000-08:00</published><updated>2011-01-02T11:07:44.994-08:00</updated><title type='text'>Grepping out comments and blank lines</title><content type='html'>One thing we commonly see in open-source configs is an abundance of helpful comments.  Often, they dwarf the number of active parameters being set and that can make things very hard to read.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the blessed world of unix, there is an easy solution to this:  you simply use grep to remove those lines from a listing of the contents of the file.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First, grep out the comments:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;grep -v \# file&lt;/span&gt;&lt;file&gt;&lt;/file&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Usually, that will leave you with a lot of unnecessary whitespace, as well.  So just pipe that output through an enhanced grep and filter for blank lines:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;grep -v \# file &lt;file&gt;| egrep -v "^$"&lt;/file&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To clarify the above, here's a break down of each component:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;grep - self explanatory&lt;/div&gt;&lt;div&gt;-v - tells grep to remove what matches rather than show it&lt;/div&gt;&lt;div&gt;\ - tells the shell the special character # is to be passed to the process without interpretation&lt;/div&gt;&lt;div&gt;# - the near-universal symbol for "comment" in config-ese&lt;/div&gt;&lt;div&gt;&lt;file&gt;file - a stand in for whatever conf you're digging through&lt;/file&gt;&lt;/div&gt;&lt;div&gt;| - a pipe.  Tells the shell to send the output of what's to the left of the pipe to what's on its right&lt;/div&gt;&lt;div&gt;egrep - grep with extended regular expressions (a sophisticated text manipulation language)&lt;/div&gt;&lt;div&gt;-v - telling egrep to remove the matches&lt;/div&gt;&lt;div&gt;"" - passing what's inside to grep without shell interpretation&lt;/div&gt;&lt;div&gt;^ - Means "the start of the line"&lt;/div&gt;&lt;div&gt;$ - Means "the end of the line"&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So what you're telling it, in essence, is the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Read the contents of file&lt;/li&gt;&lt;li&gt;Remove all lines with "#"&lt;/li&gt;&lt;li&gt;Pass the result to egrep&lt;/li&gt;&lt;li&gt;Egrep:  remove all lines which begin and immediately end (ie, a blank line) and output the result&lt;/li&gt;&lt;/ol&gt;&lt;file&gt;&lt;/file&gt;&lt;/div&gt;&lt;div&gt;This is one of those little tricks that goes a long way to simplifying interactions with Unix hosts and it's actually the first thing I do when I go to read any new service's default config.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hope it helps.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-3941096387491903865?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/3941096387491903865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/01/grepping-out-comments-and-blank-lines.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/3941096387491903865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/3941096387491903865'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2011/01/grepping-out-comments-and-blank-lines.html' title='Grepping out comments and blank lines'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-7823747341460903440</id><published>2010-10-25T03:58:00.001-07:00</published><updated>2010-10-25T04:12:01.924-07:00</updated><title type='text'>Subversion Set Up</title><content type='html'>In a nutshell, ssh to the host and run&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;su&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;apt-get install subversion&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;exit&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then, as your own user, run &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;svnadmin create [repository name]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note that if you want to share this repository with other users, you should create a group you will all share and create a special directory that you will give the group full RW access to.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For instance:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;groupadd svn&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;[add your users to the svn group in /etc/groups]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;su - [yourself]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;groups&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You should see "svn" listed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It's important to remember that even though the group has RW access to your new directory, they won't have access to the repository by default.  So give it to them explicitly:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;chown -R .svn [repo]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;chmod -R g+rw [repo]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now have your users do a checkout with their ssh accounts:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;svn co svn+ssh://[user]@[ip]/path/to/repo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;(They'll be prompted for their password twice.)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;or&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;svn co file:///path/to/repo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;on the same host.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And a commit&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;svn commit&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(Make sure everyone's commenting their commits)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you see this:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;svn: Can't open file '/home/svn/res/db/txn-current-lock': Permission denied&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Make sure they're logged in as the appropriate group and that the perms are correct.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-7823747341460903440?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/7823747341460903440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/10/subversion-set-up.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/7823747341460903440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/7823747341460903440'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/10/subversion-set-up.html' title='Subversion Set Up'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-3642963093064321307</id><published>2010-09-02T08:41:00.001-07:00</published><updated>2010-09-02T08:48:15.146-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssl file encryption unix shell'/><title type='text'>File Encryption with OpenSSL</title><content type='html'>If you're like me, you're occasionally forced to mail some pretty sensitive things around.  When that happens, it's not enough to say "Well, I deleted the message."  The message is still in your trash, on a server's disk, etc, etc.  You need to assume someone WILL get ahold of it and take measures to prevent them from doing anything with it.&lt;br /&gt;&lt;br /&gt;My personal favorite (since it can be used in any situation) is the openssl file encryption capability.  The openssl package  is almost universally installed by default in distros these days, so you should just be able to jump straight to the commands.&lt;br /&gt;&lt;br /&gt;In this case, I've got a file called "spreadsheet.xls" that I want to password encrypt.  The syntax is simply this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;openssl aes-256-cbc -a -salt -in spreadsheet.xls -out spreadsheet.xls.enc&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then just supply the password you want to use.&lt;br /&gt;&lt;br /&gt;And when you want to decrypt it, just add the '-d' switch and flip the filenames:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;openssl aes-256-cbc -d -a -in spreadsheet.xls.enc -out spreadsheet.xls&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And use your password.&lt;br /&gt;&lt;br /&gt;Just like that, you've got munition-grade encryption from the command-line.&lt;br /&gt;&lt;br /&gt;Enjoy&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-3642963093064321307?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/3642963093064321307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/09/file-encryption-with-openssl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/3642963093064321307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/3642963093064321307'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/09/file-encryption-with-openssl.html' title='File Encryption with OpenSSL'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-4876815116264918057</id><published>2010-08-14T10:35:00.000-07:00</published><updated>2010-08-14T10:48:49.361-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='monitoring zenoss error'/><title type='text'>Zenoss Quirks</title><content type='html'>So I ran into two really obnoxious issues that took a considerable amount of digging to resolve:&lt;br /&gt;&lt;br /&gt;1.  It was marking my apache process monitor as failed/recovered randomly and often.&lt;br /&gt;2.  It would not let go of misapplied process monitors that had been picked-up by overly liberal regexes.  It would include:&lt;br /&gt;&lt;br /&gt;tail -f /var/log/nginx/access.log&lt;br /&gt;nginx:  worker&lt;br /&gt;&lt;br /&gt;in the nginx process monitor if I was tailing the log when I modeled the host.  The problem was, after I killed the tail, the process was alerting as "Process Not Running".  FOREVER.  Even if I deleted and recreated the process monitor, the host, the events, everything.&lt;br /&gt;&lt;br /&gt;In the first case, it turns out that since apache marks its process as "apache defunct&lt;defunct&gt;" when it's shutting down a child process, Zenoss would occasionally pick this up as a live apache process.  It would then mark it as "Down" after the proc terminated.  The solution for this was to make my regex more specific:&lt;br /&gt;&lt;br /&gt;apache2 \-k start&lt;br /&gt;&lt;br /&gt;The second case was much more obnoxious because not only would the events not clear, they would return and begin alerting every time the device was recreated.&lt;br /&gt;&lt;br /&gt;After some digging online, it seemed that the best course was to restart the zenprocess daemon.&lt;br /&gt;&lt;br /&gt;This is best done under Settings &gt; Daemons.  You can also view the logs there (which showed the bad checks prior to the restart and nothing after).&lt;br /&gt;&lt;br /&gt;When that's complete, re-add your device and you should be rid of the baggage.&lt;/defunct&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-4876815116264918057?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/4876815116264918057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/08/zenoss-quirks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4876815116264918057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4876815116264918057'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/08/zenoss-quirks.html' title='Zenoss Quirks'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-1923004311347539153</id><published>2010-07-28T07:16:00.000-07:00</published><updated>2010-09-02T11:22:18.176-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu iphone tethering'/><title type='text'>Tethering your iPhone in Ubuntu</title><content type='html'>This is a delightfully easy one.  First, add this repository and update your apt:&lt;br /&gt;&lt;em&gt;&lt;strong&gt;&lt;br /&gt;sudo add-apt-repository &lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;ppa:pmcenery/ppa&lt;/strong&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;sudo apt-get update&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;Now install the following three packages (you may have to go dig for them):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;libimobiledevice-utils&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;ipheth-dkms&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;ipheth-uti&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;ls&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Restart your machine.&lt;br /&gt;&lt;br /&gt;Turn on tethering inside your iPhone's General &gt; Network menu.&lt;br /&gt;&lt;br /&gt;Cable your iPhone to a USB port.&lt;br /&gt;&lt;br /&gt;It should automatically connect. You'll see it in Network Manager.&lt;br /&gt;&lt;br /&gt;Poof.  Magic.&lt;br /&gt;&lt;a href="https://launchpad.net/ubuntu/maverick/i386/ipheth-dkms"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-1923004311347539153?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/1923004311347539153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/07/tethering-your-iphone-in-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/1923004311347539153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/1923004311347539153'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/07/tethering-your-iphone-in-ubuntu.html' title='Tethering your iPhone in Ubuntu'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-798751182727416199</id><published>2010-07-25T16:53:00.000-07:00</published><updated>2010-07-25T17:05:31.446-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssh osx'/><title type='text'>Enabling SSH Agent Forwarding in OS X</title><content type='html'>If you use EC2, you use SSH keys.  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you're sane, you keep the private keys on your workstation and forward them through the chain of public keys throughout your hosts.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I recently started working through OS X again and found some pretty obnoxious behavior:  out of the box, the ssh keys don't forward.  After some digging, I found the following discussion of the subject:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;http://data.agaric.com/node/3061#comment-1604&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Long story short, it appears that the location of the user's home directory isn't communicated when the keys are forwarded so the agent looks in the wrong place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The fix?  Run these two on your OS X machine:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;ssh-add&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;ssh-add -l&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;et voila&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;Try again.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-798751182727416199?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/798751182727416199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/07/enabling-ssh-agent-forwarding-in-os-x.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/798751182727416199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/798751182727416199'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/07/enabling-ssh-agent-forwarding-in-os-x.html' title='Enabling SSH Agent Forwarding in OS X'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-3032859068439077101</id><published>2010-07-08T13:13:00.001-07:00</published><updated>2010-07-28T07:25:47.961-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debian ubuntu dpkg'/><title type='text'>Removing packages from Debian/Ubuntu</title><content type='html'>Just a quick note so I don't waste time revisiting this topic again.&lt;br /&gt;&lt;br /&gt;A coworker of mine forced a package install without repositories so all the dependencies obviously failed.  Trying to remove it, I did a&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;dpkg --remove &lt;package&gt;&lt;/package&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But running an apt-get said it was still installed.  Running&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;dpkg --list &lt;package&gt;&lt;/package&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Gave me a status of "rc" - which left a lot of files laying around.  (Configs, etc.)&lt;br /&gt;&lt;br /&gt;Finally, I just did a&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;dpkg --purge &lt;package&gt;&lt;/package&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And it cleared out all the junk.&lt;br /&gt;&lt;br /&gt;From there, I was able to do a normal apt-get against the repositories.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-3032859068439077101?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/3032859068439077101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/07/removing-packages-from-debianubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/3032859068439077101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/3032859068439077101'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/07/removing-packages-from-debianubuntu.html' title='Removing packages from Debian/Ubuntu'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-6049955468516172612</id><published>2010-06-30T10:44:00.000-07:00</published><updated>2010-07-28T07:26:25.610-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mail relay exim'/><title type='text'>Using Exim as a Mail Relay</title><content type='html'>One service that always seems required by any platform I've ever worked on is an outbound mail transfer agent.  Essentially, everybody wants to send their customers notifications and needs a clearinghouse to pass it through.&lt;br /&gt;&lt;br /&gt;This is all well and good, but there are a few inevitable problems one is likely to run into when putting one up.&lt;br /&gt;&lt;br /&gt;By far, I've had the most success with Exim running on Debian since both are very lightweight, incredibly reliable and closely intertwined.  (Exim is Debian's default MTA.)&lt;br /&gt;&lt;br /&gt;Step 1 is to provide the basic setup.  Log in, su to root and run the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;dpkg-reconfigure exim4-config&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;You'll walk through some basic setup info.  Essentially, you want to specify the host as an internet mail server and provide the ip addresses of your internal hosts are valid hosts to relay for.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;When that's complete, you need to cd into /etc/exim4 and modify the exim4.conf.template file.  Find the rewrite section by looking for &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;begin rewrite&lt;br /&gt;&lt;br /&gt;Then add your rewrite rule under it.  This will make it apply to all messages that pass thorugh Exim.&lt;br /&gt;&lt;br /&gt;The generic rule I usually use looks like this:&lt;br /&gt;&lt;br /&gt;*@* $1@&lt;my&gt;&lt;span style="font-style: italic;"&gt;mycompanysdomain&lt;/span&gt; Ffrs&lt;br /&gt;&lt;br /&gt;What it essentially says is "match everthing (*@*) and replace what's in front of the @ with what was to the left of the original and everything after the @ with with explicit domain name - also, apply it to the following types of addresses:  F - envelope From field, f - From header, r - Reply-To header, s - Sender header"&lt;br /&gt;&lt;br /&gt;With that rule in place, restart Exim:&lt;br /&gt;&lt;br /&gt;invoke-rc.d exim4 restart&lt;br /&gt;&lt;br /&gt;And the config will be written out to &lt;span style="font-weight: bold;"&gt;/var/lib/exim4/configuration.autogenerated.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;The best way to test is to use the Exim command line to see what rewrites will get applied:&lt;br /&gt;&lt;br /&gt;# exim -brw root@localhost&lt;br /&gt;sender: root@&lt;/span&gt;&lt;/span&gt;&lt;/my&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-style: italic;"&gt;mycompanysdomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;my&gt;&lt;span&gt;&lt;span&gt;&lt;company&gt;from: root@&lt;/company&gt;&lt;/span&gt;&lt;/span&gt;&lt;/my&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span&gt;&lt;span&gt;&lt;company&gt;&lt;/company&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-style: italic;"&gt;mycompanysdomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span&gt;&lt;span&gt;  to: root@localhost&lt;br /&gt;cc: root@localhost&lt;br /&gt;bcc: root@localhost&lt;br /&gt;reply-to: root@&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span&gt;&lt;span&gt;&lt;company&gt;&lt;/company&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-style: italic;"&gt;mycompanysdomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span&gt;&lt;span&gt;  env-from: root@&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span&gt;&lt;span&gt;&lt;company&gt;&lt;/company&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-style: italic;"&gt;mycompanysdomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span&gt;&lt;span&gt;  env-to: root@localhost&lt;br /&gt;&lt;br /&gt;With that done, you need to take care of the blacklists.  First, add an A record to your domain's authoritative DNS WITH A PTR.  The reverse lookup is used as a method to ensure the mail server is a legitimate member of your domain.  NOTE:  A lot of people think MX records are required but that's incorrect.  MX records are for inbound mail only.&lt;br /&gt;&lt;br /&gt;Now fire off some messages to big mail destinations like gmail and yahoo.  Tail the /var/log/exim4/mainlog to see what results you get.  Yahoo especially is good about telling you where your IP is blacklisted for some reason.  If it is, you'll get a lot of dropped messages till you contact the Blacklister and petition to have it removed.&lt;br /&gt;&lt;br /&gt;On that same note, be careful about sending out a bunch of unsoliticed test messages.  I've seen hosts get black-listed for that reason alone and it's a pain to get delisted.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-6049955468516172612?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/6049955468516172612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/06/using-exim-as-mail-relay.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6049955468516172612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6049955468516172612'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/06/using-exim-as-mail-relay.html' title='Using Exim as a Mail Relay'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-5168609939295835664</id><published>2010-05-21T07:10:00.001-07:00</published><updated>2010-07-28T07:27:33.443-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash shell'/><title type='text'>Checking for Root</title><content type='html'>Good programmers know to check for assumptions their code is making before executing it.  For an operator, assuming that you've su'd to root before running an installer you've written is a bad idea.&lt;br /&gt;&lt;br /&gt;The easiest way to resolve that is to simply use the EUID bash variable to check the effective user-id you're executing under and then exit if it's not zero.&lt;br /&gt;&lt;br /&gt;I cribbed the following&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if [[ $EUID -ne 0 ]]; then&lt;br /&gt;  echo "This script must be run as root"&lt;br /&gt;  exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;From this excellent article:&lt;br /&gt;&lt;br /&gt;http://www.cyberciti.biz/tips/shell-root-user-check-script.html&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-5168609939295835664?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/5168609939295835664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/05/checking-for-root.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5168609939295835664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5168609939295835664'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/05/checking-for-root.html' title='Checking for Root'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-4594693270488555420</id><published>2010-05-20T07:57:00.000-07:00</published><updated>2010-07-28T07:27:20.211-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='awk bash shell'/><title type='text'>Awk Alternative Delimiters</title><content type='html'>As it's always best to automate, it's often useful to fill the values of shell variables with the returned values of system commands.&lt;br /&gt;&lt;br /&gt;For instance, if you wanted the ip of eth0, you could run&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-weight: bold;"&gt;/sbin/ifconfig eth0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;And you'd get back something like&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[nsmc@nsmc-dt automation]$ /sbin/ifconfig eth0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;eth0      Link encap:Ethernet  HWaddr 00:26:F2:AC:C2:FE &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;          inet addr:10.1.1.99  Bcast:10.1.3.255  Mask:255.255.252.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;          inet6 addr: fe80::226:f2ff:feac:c2fe/64 Scope:Link&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;          RX packets:1142141 errors:0 dropped:0 overruns:0 frame:0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;          TX packets:223927 errors:0 dropped:0 overruns:0 carrier:0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;          collisions:0 txqueuelen:1000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;          RX bytes:212209959 (202.3 MiB)  TX bytes:205106885 (195.6 MiB)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;          Interrupt:18 Base address:0x2000&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Then you could vi into your config script and export the value to a var manually.&lt;br /&gt;&lt;br /&gt;-OR-&lt;br /&gt;&lt;br /&gt;You could set the variable with the returned value of a system command after clearing away some noise.&lt;br /&gt;&lt;br /&gt;Using an iterative approach, we could peel back each layer till we get the piece we want:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-weight: bold;"&gt;/sbin/ifconfig eth0 | grep "inet "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;That gives us the "inet" line and not the "inet6" line.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[nsmc@nsmc-dt automation]$ /sbin/ifconfig eth0 | grep "inet "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;          inet addr:10.1.1.99  Bcast:10.1.3.255  Mask:255.255.252.0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;But we only want the piece behind the first colon.  Here we need to use a little awk trickery.  awk uses spaces for it's default field delimiters.  Let's change that to a colon (:) and see what we get.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-weight: bold;"&gt;[nsmc@nsmc-dt automation]$ /sbin/ifconfig eth0 \&lt;br /&gt;| grep "inet " | awk -F \: '{print $2}'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;10.1.1.99  Bcast&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Close.  Now we can pass it through a standard awk filter and just get the piece we want:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[nsmc@nsmc-dt automation]$ /sbin/ifconfig eth0 | grep "inet " \&lt;br /&gt;| awk -F \: '{print $2}' | awk '{print $1}'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;10.1.1.99&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;Now we just need to assign to our variable at runtime using the backtic's:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;export PRIVATE_HOST_IP=`/sbin/ifconfig eth0 | grep "inet " \&lt;br /&gt;| awk -F \: '{print $2}' | awk '{print $1}'`&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-4594693270488555420?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/4594693270488555420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/05/awk-alternative-delimiters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4594693270488555420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4594693270488555420'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/05/awk-alternative-delimiters.html' title='Awk Alternative Delimiters'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-5685485784601166550</id><published>2010-04-27T15:48:00.001-07:00</published><updated>2010-07-28T07:27:00.512-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sed bash shell'/><title type='text'>Escaping Single-Quotes in sed</title><content type='html'>This is a just a re-post of this excellent &lt;a href="http://muffinresearch.co.uk/archives/2007/01/30/bash-single-quotes-inside-of-single-quoted-strings/"&gt;article&lt;/a&gt; by Stuart Coleville:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Using single quotes in BASH ensures that the shell doesn’t expand the  contents of the quoted string and this is useful most of the time.  However if you want to use single quotes within a single quoted string  things don’t work out as you might expect. &lt;/p&gt;If I want to use sed to match some text with a single quotes in it, I  will run into trouble if I run: &lt;p&gt;&lt;code&gt;sed 's/user \= 'root/user \= 'moi/g'&lt;/code&gt;&lt;/p&gt;Alternatively if I run (on the same snippet): &lt;p&gt;&lt;code&gt;sed 's/user \= \'root/user \= \'moi/g'&lt;/code&gt;&lt;/p&gt; &lt;p&gt;I will get:&lt;/p&gt; &lt;p&gt;&lt;code&gt;/bin/bash: -c: line 1: unexpected EOF while looking for  matching `''&lt;br /&gt;/bin/bash: -c: line 2: syntax error: unexpected end of file&lt;/code&gt;&lt;/p&gt; &lt;p&gt;This doesn’t work because the escaped single-quotes (&lt;code&gt;\'&lt;/code&gt;)  are not expanded and are therefore treated literally.&lt;/p&gt; &lt;p&gt;To single quotes work you need to break out of the single quoted  string &lt;em&gt;then&lt;/em&gt; escape your single quote. Like so:&lt;/p&gt; &lt;p&gt;&lt;code&gt;sed 's/user \= '\''root/user \= '\''moi/g'&lt;/code&gt;&lt;/p&gt; &lt;p&gt;Because &lt;code&gt;\'&lt;/code&gt; is not inside of single quotes the  single-quote is properly escaped and the output is as we’d expect:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;user = 'root' -&gt;  user = 'moi'&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;In conclusion, the title of this post is a bit of a misnomer. You   actually can’t put single quotes &lt;em&gt;inside&lt;/em&gt; of a single-quoted  string. However breaking out allows us to get to where we want to be.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-5685485784601166550?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/5685485784601166550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/04/escaping-single-quotes-in-sed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5685485784601166550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5685485784601166550'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/04/escaping-single-quotes-in-sed.html' title='Escaping Single-Quotes in sed'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-7302601044307113234</id><published>2010-04-18T08:04:00.001-07:00</published><updated>2010-04-18T08:18:11.299-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ec2 tools cli'/><title type='text'>Installing Amazon EC2 tools to Debian Lenny</title><content type='html'>I was reading through Bill Childers excellent article in Linux Journal on running Ubuntu under EC2 and I thought I add my notes on how to make the client tools run on Debian.&lt;br /&gt;&lt;br /&gt;First, install the Sun JDK (see my previous post on how to do that).&lt;br /&gt;&lt;br /&gt;With that done, download the tools from this page:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351&amp;amp;categoryID=251"&gt;AWS Developer Community&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Or simply by using this link:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/gp/redirect.html/ref=aws_rc_ec2tools?location=http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip&amp;amp;token=A80325AA4DAB186C80828ED5138633E3F49160D9"&gt;ec2-api-tools.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Next, unzip them.&lt;br /&gt;&lt;br /&gt;Then create a configuration file to export the proper environment variables when your shell fires up:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;$ vi ~/.ec2.conf&lt;/span&gt;&lt;br /&gt;Add the lines:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;export EC2_CERT=&lt;whereveryourx509is&gt;&lt;span style="font-style: italic;"&gt;whereveryourx509lives&lt;/span&gt;/cert-&lt;span style="font-style: italic;"&gt;whatever&lt;/span&gt;&lt;whatever&gt;-x509.pem&lt;/whatever&gt;&lt;/whereveryourx509is&gt;&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;&lt;br /&gt;export EC2_PRIVATE_KEY=&lt;whereveryourprivatex509keyis&gt;&lt;span style="font-style: italic;"&gt;whereveryourx509pklives&lt;/span&gt;/pk-&lt;span style="font-style: italic;"&gt;whatever&lt;/span&gt;&lt;whatever&gt;-x509.pem &lt;/whatever&gt;&lt;/whereveryourprivatex509keyis&gt;&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;&lt;br /&gt;export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;export EC2_HOME=&lt;span style="font-style: italic;"&gt;whereveryourec2toolswererunzipped&lt;/span&gt;&lt;wherever the="" unzipped="" ec2="" tools="" folder="" is=""&gt;&lt;/wherever&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Save it.&lt;br /&gt;&lt;br /&gt;Now add this to the bottom of your &lt;span style="font-weight: bold;"&gt;.bashrc&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;. ~/.ec2.conf&lt;/span&gt;&lt;br /&gt;Start a new shell and test for the var's using:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;$ export | grep EC2&lt;/span&gt;&lt;br /&gt;if they're there, you're all set.&lt;br /&gt;&lt;br /&gt;Now test by cd'ing into your ec2 tools bin folder and running:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;ec2-describe-images -o self -o amazon&lt;/span&gt;&lt;br /&gt;If you get a huge java stack trace, changes are your jdk isn't installed properly.&lt;br /&gt;&lt;br /&gt;Otherwise, you should get a very long list of all the amazon AMI's available to run from.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-7302601044307113234?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/7302601044307113234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/04/installing-amazon-ec2-tools-to-debian.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/7302601044307113234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/7302601044307113234'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/04/installing-amazon-ec2-tools-to-debian.html' title='Installing Amazon EC2 tools to Debian Lenny'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-3845805498168390667</id><published>2010-04-18T07:53:00.000-07:00</published><updated>2010-04-18T07:58:50.104-07:00</updated><title type='text'>Installing the JDK to Debian Lenny</title><content type='html'>The first thing to keep in mind is that Debian tries with all its might to remain free and open.  In that regard, it resists including proprietary packages - even popular ones - in its main repositories.&lt;br /&gt;&lt;br /&gt;So to give debian access to everything, you need to edit your&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;/etc/apt/source.list&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;use the following command in vi to include the contrib and non-free packages in your configured repositories:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;:%s/main/main contrib non-free/g&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;:wq&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For the sake of being thorough, run&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;# apt-get update&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;# apt-get install sun-java6-jdk&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Answer in the affirmative to the various prompts.&lt;br /&gt;&lt;br /&gt;When you're complete, adjust your alternatives like so:&lt;br /&gt;&lt;span style="font-family: monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;#update-java-alternatives -s java-6-sun&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;et voila&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-3845805498168390667?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/3845805498168390667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/04/installing-jdk-to-debian-lenny.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/3845805498168390667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/3845805498168390667'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/04/installing-jdk-to-debian-lenny.html' title='Installing the JDK to Debian Lenny'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-5917771712184624913</id><published>2010-04-13T09:28:00.000-07:00</published><updated>2010-04-13T09:30:31.309-07:00</updated><title type='text'>Finding Installed Ruby Lib's</title><content type='html'>Since I can't seem to escape ruby, it would seem prudent to start documenting how to pick it apart.&lt;br /&gt;&lt;br /&gt;Here's a little one-liner I just picked up apropos of puppet that tells you whether a lib is present:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;# ruby -r&lt;library&gt; -e "puts :installed"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If it's there, you'll see "installed".  If not, something like "no such package".&lt;br /&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-5917771712184624913?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/5917771712184624913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/04/finding-installed-ruby-libs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5917771712184624913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5917771712184624913'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/04/finding-installed-ruby-libs.html' title='Finding Installed Ruby Lib&apos;s'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-2763948537482659418</id><published>2010-03-24T12:16:00.000-07:00</published><updated>2010-03-24T13:01:17.860-07:00</updated><title type='text'>Setting Linux Timezone from the Shell</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;p&gt; Assuming you've got NTP, etc set up, your issue shouldn't be any more  complicated than&lt;/p&gt; &lt;p&gt; 1. Setting it properly in &lt;strong&gt;/etc/localtime&lt;/strong&gt;:&lt;/p&gt; &lt;pre&gt;cp /etc/localtime /etc/localtime.ORIG; &lt;/pre&gt;&lt;pre&gt;cat /usr/share/zoneinfo/America/New_York &gt; /etc/localtime &lt;/pre&gt;&lt;br /&gt;&lt;p&gt; 2. Change &lt;strong&gt;/etc/sysconfig/clock&lt;/strong&gt; to&lt;/p&gt; &lt;pre&gt;ZONE="America/New_York" &lt;/pre&gt;&lt;pre&gt;UTC=true &lt;/pre&gt;&lt;pre&gt;ARC=false &lt;/pre&gt;&lt;br /&gt;&lt;p&gt; No OS restart is required, but it's probably a good idea. Any process  with a JVM almost certainly needs one, though.&lt;/p&gt; &lt;p&gt; Note that the original localtime file is backed up in the line above, in  case you need it.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-2763948537482659418?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/2763948537482659418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/03/setting-linux-timezone-from-shell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/2763948537482659418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/2763948537482659418'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/03/setting-linux-timezone-from-shell.html' title='Setting Linux Timezone from the Shell'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-6788424873206148308</id><published>2010-03-19T15:25:00.000-07:00</published><updated>2010-03-19T15:30:03.304-07:00</updated><title type='text'>Forgot to screen?</title><content type='html'>Sometimes even the best of us forget to invoke screen prior to running a long job.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I found an excellent workaround on serverfault (&lt;a href="http://serverfault.com/questions/55880/moving-an-already-running-process-to-screen"&gt;http://serverfault.com/questions/55880/moving-an-already-running-process-to-screen&lt;/a&gt;) that I'll repost in case it vanishes.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Simply put, you detach the process from your login shell using "disown".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cntl-z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;bg&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;jobs&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;disown -h %&lt;i&gt;jobspec-id-from-jobs&lt;/i&gt;&lt;jobspec&gt;&lt;/jobspec&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And just like that, you've bullet-proofed it from a sighup.  Kill your shell and pack up for the night because it'll run to completion.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-6788424873206148308?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/6788424873206148308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/03/forgot-to-screen.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6788424873206148308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6788424873206148308'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2010/03/forgot-to-screen.html' title='Forgot to screen?'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-6900860700068909489</id><published>2009-11-02T11:24:00.000-08:00</published><updated>2009-11-02T11:50:19.507-08:00</updated><title type='text'>Formatting Tool Output for Reports</title><content type='html'>If you're like me, you use cron to mail you a variety of stats generated during off-peak ours.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You may, at some point, want to start extrapolating patterns from the data you've collected.  In my experience, nothing really gets the job done in this scenario quite like a spreadsheet.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That being said, the data generated by most tools is reader-friendly, not import-friendly.  Therefore, they must be munged in order to add them to your data set.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Most of them use tabs to do their spacing/formatting.  I have written a quick sed hack that removes one or more instances of a tab from a line and converts it to a comma.  The end result is essentially a CSV.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, to format the output of a&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;du -sm /home/*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;you could pipe it through sed and into a mail command.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ie:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;du -sm /home/* | sed  -e '/txt/d;s/\t\t*/,/' | mail -s "Usage" nathan@mccourtney.com&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;the '-e' lets it know that there is more than one command being passed - separated by a ';'.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this case, I'm using the first part of the command to delete every line with 'txt' in it, since I'm really not worried about the text files.  The second part matches at least one tab and all the tabs following it, then replaces them with a single ','.  The output it then piped to a mail command and sent to my account.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When it shows up, the output goes from &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;nsmc@bangkok:~$ du -sm /home/*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;1786&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;/home/nathan&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;to&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;!--StartFragment--&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;1786,/home/nsmc&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;!--EndFragment--&gt;  &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:130%;"&gt;&lt;span class="Apple-style-span"  style="font-size:15px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;It's not terribly pretty, but you can easily import it into a spreadsheet.  And really, I use a slightly more complex du script that generates a more readable listing before it even gets to sed.  This was intended just to show the sed side of it.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-6900860700068909489?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/6900860700068909489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/11/formatting-tool-output-for-reports.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6900860700068909489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6900860700068909489'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/11/formatting-tool-output-for-reports.html' title='Formatting Tool Output for Reports'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-5918075175439658587</id><published>2009-10-20T10:15:00.000-07:00</published><updated>2009-10-20T10:22:50.067-07:00</updated><title type='text'>ulimit - Runtime system resource tuning</title><content type='html'>When you're dealing with daemons, you're likely to run into the system's process-level constraints.  In additional to the kernel params that are set in the setup scripts, there are process limits you need to be aware of to keep from bumping your head.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The shell has a built-in command to query and set those values:  ulimit.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;ulimit: usage: ulimit [-SHacdfilmnpqstuvx] [limit]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;brutus:~ nsmc$ ulimit -a&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;core file size          (blocks, -c) 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;data seg size           (kbytes, -d) unlimited&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;file size               (blocks, -f) unlimited&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;max locked memory       (kbytes, -l) unlimited&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;max memory size         (kbytes, -m) unlimited&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;open files                      (-n) 256&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;pipe size            (512 bytes, -p) 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;stack size              (kbytes, -s) 8192&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cpu time               (seconds, -t) unlimited&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;max user processes              (-u) 266&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;virtual memory          (kbytes, -v) unlimited&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As you can see, there are very tight limits on this system for the number of processes a user can run, as well as the number of files any of those processes can have open.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;These values can be set using a basic syntax:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;#ulimit -n 9162&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;However, they won't survive a reboot.  Since these limits are tied to the shell process that invokes them, you need to set them in /etc/bashrc (or whatever your shell takes its initialization parameters from) in order to have them come up automatically.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-5918075175439658587?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/5918075175439658587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/10/ulimit-runtime-system-resource-tuning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5918075175439658587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5918075175439658587'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/10/ulimit-runtime-system-resource-tuning.html' title='ulimit - Runtime system resource tuning'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-650656381992274494</id><published>2009-09-23T08:00:00.001-07:00</published><updated>2009-09-23T08:18:40.719-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>egrep - LOVE it</title><content type='html'>'egrep' is an alias for grep invoked with the '-e' switch to enable extended regular expressions.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The reason I especially love it is its ability to use inclusive "or's".  In other words, give me all the lines with x, y or z.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So if you want to see a count of all the mails sent to your exim daemon from say, 5 to 8 pm on 9/22, you can simply execute the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;egrep '(2009-09-22 17|2009-09-22 18|2009-09-22 19|2009-09-22 20)' mainlog.1 | grep dnslookup | wc -l&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And voila!  You will have your answer.&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-650656381992274494?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/650656381992274494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/09/egrep-love-it.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/650656381992274494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/650656381992274494'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/09/egrep-love-it.html' title='egrep - LOVE it'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-9048168560074530689</id><published>2009-09-21T16:34:00.000-07:00</published><updated>2009-09-21T16:37:25.413-07:00</updated><title type='text'>Reading Top on Multi-core Systems</title><content type='html'>&lt;!--StartFragment--&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Take this sample output:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;  &lt;/span&gt;&lt;span style="font-family:Courier, Courier New;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;top - 11:24:56 up 2 days, 11:19,  2 users,  load average: 0.45, 0.34, 0.32&lt;br /&gt;Tasks: 176 total,   1 running, 175 sleeping,   0 stopped,   0 zombie&lt;br /&gt;Cpu(s):  3.1%us,  0.4%sy,  0.0%ni, 96.3%id,  0.1%wa,  0.0%hi,  0.1%si,  0.0%st&lt;br /&gt;Mem:   8174036k total,  7693556k used,   480480k free,   260924k buffers&lt;br /&gt;Swap:  2031608k total,        4k used,  2031604k free,  5043372k cached&lt;br /&gt;&lt;br /&gt;  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                   &lt;br /&gt;26229 root      25   0 2181m 1.5g  96m S   28 18.7 133:33.65 java                                                                                                                       &lt;br /&gt; 3388 root      18   0 67692 2240 1732 S    0  0.0   0:01.95 rotatelogs                                                                                                                 &lt;br /&gt;16890 nsmc      15   0 12736 1144  816 R    0  0.0   0:00.51 top      &lt;br /&gt;&lt;/span&gt;  &lt;/span&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;What we’re seeing seems completely contradictory - the java process is consuming 28 percent of the cpu's resources, but the total user process consumption on the system is 3 percent?&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Basically, a rollup of CPU time on a multicore system is going to be an over-simplification.  It’s essentially the total cpu of all processes divided by the number of cores.  (In this case, eight). &lt;br /&gt;&lt;br /&gt;Using the run-time command of ‘1’ (that’s the number one), you get a different output:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;   &lt;/span&gt;&lt;span style="font-family:Courier, Courier New;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;top - 11:28:25 up 2 days, 11:23,  2 users,  load average: 0.14, 0.21, 0.27&lt;br /&gt;Tasks: 174 total,   1 running, 173 sleeping,   0 stopped,   0 zombie&lt;br /&gt;Cpu0  : 13.3%us,  1.3%sy,  0.0%ni, 84.1%id,  0.7%wa,  0.0%hi,  0.7%si,  0.0%st&lt;br /&gt;Cpu1  :  0.3%us,  0.0%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st&lt;br /&gt;Cpu2  :  1.0%us,  0.0%sy,  0.0%ni, 99.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st&lt;br /&gt;Cpu3  :  0.7%us,  0.0%sy,  0.0%ni, 99.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st&lt;br /&gt;Cpu4  :  1.0%us,  0.0%sy,  0.0%ni, 99.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st&lt;br /&gt;Cpu5  :  0.7%us,  0.0%sy,  0.0%ni, 99.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st&lt;br /&gt;Cpu6  :  0.7%us,  0.0%sy,  0.0%ni, 99.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st&lt;br /&gt;Cpu7  :  0.7%us,  0.3%sy,  0.0%ni, 99.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st&lt;br /&gt;Mem:   8174036k total,  7754924k used,   419112k free,   261028k buffers&lt;br /&gt;Swap:  2031608k total,        4k used,  2031604k free,  5104464k cached&lt;br /&gt;&lt;br /&gt;  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                   &lt;br /&gt;26229 root      25   0 2181m 1.5g  96m S   20 18.7 134:23.33 java    &lt;br /&gt;&lt;/span&gt;  &lt;/span&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;That makes a LOT more sense.  So the default output is showing the cpu consumption of the java process at the individual core level, but the rollup as an average across all the cores.  This  new output shows how it’s getting distributed across the cores.&lt;br /&gt;&lt;br /&gt;By the same token, if you go back to the default output and hit ‘I’ (that’s a capital i), you will get a cpu consumption number for the java process divided by the number of cores:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;   &lt;/span&gt;&lt;span style="font-family:Courier, Courier New;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;top - 11:31:31 up 2 days, 11:26,  2 users,  load average: 0.14, 0.22, 0.26&lt;br /&gt;Tasks: 174 total,   1 running, 173 sleeping,   0 stopped,   0 zombie&lt;br /&gt;Cpu(s):  3.0%us,  0.5%sy,  0.0%ni, 96.0%id,  0.3%wa,  0.0%hi,  0.2%si,  0.0%st&lt;br /&gt;Mem:   8174036k total,  7808624k used,   365412k free,   261136k buffers&lt;br /&gt;Swap:  2031608k total,        4k used,  2031604k free,  5156848k cached&lt;br /&gt;&lt;br /&gt;  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                   &lt;br /&gt;26229 root      25   0 2181m 1.5g  96m S  3.5 18.7 135:04.92 java                                                                                                                       &lt;br /&gt;16890 nsmc      15   0 12736 1144  816 R  0.0  0.0   0:01.32 top                                                                                                                        &lt;br /&gt;    1 root      15   0 10344  680  572 S  0.0  0.0   0:02.47 init              &lt;br /&gt;&lt;/span&gt;  &lt;/span&gt;&lt;span style="font-family:Calibri, Verdana, Helvetica, Arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;So now you’re consistent again.&lt;br /&gt;&lt;br /&gt;I’m not sure why these two are aren’t viewed from the same perspective by default.&lt;/span&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;   &lt;/span&gt;&lt;!--EndFragment--&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-9048168560074530689?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/9048168560074530689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/09/reading-top-on-multi-core-systems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/9048168560074530689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/9048168560074530689'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/09/reading-top-on-multi-core-systems.html' title='Reading Top on Multi-core Systems'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-5585093574432596022</id><published>2009-08-25T07:33:00.000-07:00</published><updated>2009-08-25T08:11:16.579-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iostat'/><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='storage'/><category scheme='http://www.blogger.com/atom/ns#' term='vmstat'/><category scheme='http://www.blogger.com/atom/ns#' term='iops'/><title type='text'>IOPS</title><content type='html'>Input/Output Per Second (aka "IOPS") is a performance metric for hard disks that represents how many storage operations (reads/writes) the disk can execute in a given second.  This, combined with how much actual data can be passed per operation, determines the throughput of the disk.  The difference between the two is important since a 1 byte operation has the same IOP hit as a 1KB operation.  (Assuming your drive can handle at least 1KB per operation.)&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can find the number of iops being used by your system via &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;vmstat&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;HOST::~$ vmstat 5&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; 0  0      0  50432    388 1083600    0    0   407   290    1    0  1  5 88  6&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; 0  0      0  49892    388 1084348    0    0   119    39 1295 1182  0  2 92  6&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; 0  0      0  56856    388 1078296    0    0   324    99 1799 1972  0  4 86 10&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; 0  0      0  56440    388 1078704    0    0    87     7 1673 1885  0  4 93  2&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; 0  0      0  54880    388 1080472    0    0   320    32 1573 1518  0  2 89  8&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; 0  0      0  53020    388 1082512    0    0   384    43 1556 1536  0  2 91  6&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; 1  0      0  51568    388 1083736    0    0   232    45 1460 1453  0  1 90  8&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note that with &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;vmstat&lt;/span&gt;, you can ignore the first line - it's a rollup average of stats since the last restart.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The stats you want to look at are &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;io:  bi&lt;/span&gt; and &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;bo&lt;/span&gt; and cpu's &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;wa&lt;/span&gt;.  &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;bi&lt;/span&gt; stands for "Blocks In" and &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;bo&lt;/span&gt; for "Blocks Out".  It's a bit counter-intuitive, though, in that they represent blocks moving into and out of the kernel's memory space, NOT into and out of the device.  In fact, because of that distinction, writes to devices are actually represented by &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;bo&lt;/span&gt; and reads from are represented by &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;bi&lt;/span&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;wa&lt;/span&gt; stands for "wait time" and tells you how much of your cpu time is spent waiting for I/O to complete before moving to the next instruction.  If your wait time is high, your device I/O is getting choked - probably from insufficient IOPS capacity.  You can track down which device it is using &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;iostat&lt;/span&gt;, though figuring out which process is responsible is still a bit of an art.  (I'm pretty sure the hooks for doing it are only just starting to make their way into the kernel.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In a RAID environment, the number of IOPS is an aggregation of all the disks that are active within the RAID group.  (It doesn't include any online spares that are sitting around idle.)  This is essentially the speed limit for a group of disks.  If you attempt to perform more I/O operations than your RAID can support, the device or host will have to start queueing them which will lead to dramatically increased CPU wait time.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The performance numbers for IOPS take a little digging to find so I wanted to drop them here for future reference:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SAS - Serial Attached SCSI - 175 for 15K, 125 10K &lt;/div&gt;&lt;div&gt;SATA - Serial ATA - 100 +/-&lt;/div&gt;&lt;div&gt;FC - Fibre Channel - 200 for 15K, 150 for 10K&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note that THESE NUMBERS WILL CHANGE.  It represents the current state of things based on my interaction with vendors.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Multiply these numbers by the number of drives that are part of the active RAID and you'll know the theoretical upper boundary of your performance.  (Which you can then compare to your &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;vmstat&lt;/span&gt; to see where you're landing.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A great article for more information on how to calculate IOPS/etc:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;http://storagearchitect.blogspot.com/2008/09/how-many-iops.html&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-5585093574432596022?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/5585093574432596022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/08/iops.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5585093574432596022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/5585093574432596022'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/08/iops.html' title='IOPS'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-6503615183345157028</id><published>2009-07-31T16:07:00.000-07:00</published><updated>2009-07-31T16:12:51.957-07:00</updated><title type='text'>How to trace end-to-end connections on the Netscaler Load-balancer</title><content type='html'>&lt;div&gt;HOW-TO: View Active Sessions End-To-End on the Netscalers&lt;/div&gt;&lt;div&gt;hide&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First, the easiest way to see what the source IP's for traffic are is via the ASA firewall logs in syslog.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So to see where ftp connections are coming from, you could use something like&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;grep [ftp cluster vip] syslog | grep -v ICMP | grep -v [monitoring host's ip] | grep -v local-host&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Which greps for the netscaler virtual ip of the ftp-cluster in the syslog file and filters out ICMP and monitoring-host traffic. (As well as connections to itself.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Additionally, you can see all the active connections on a netscaler by ssh'ing to the CLI and running:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&gt; show connectiontable | grep [ftp cluster vip]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;[client ip]   45534   [ftp cluster vip]     21      FTP          7       TIME_WAIT   &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;[client ip]    32570   [ftp cluster vip]     21      FTP          9       ESTABLISHED&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That shows you where they're coming from. To find out where they're going to, also, you need to check the persistent connections:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&gt; show persistence&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Type             SRC-IP         DST-IP           PORT  VSNAME      TIMEOUT  REF_CNT &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;SOURCEIP       [client ip]  [ftp server ip]      21    ftp_cluster &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;103     &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, fantasy; font-size: 16px; "&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;SOURCEIP       [client ip]  [ftp server ip]      21    ftp_cluster &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;0       &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;1    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;SOURCEIP       [client ip]  [ftp server ip]      21    ftp_cluster &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;75      &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;SOURCEIP       [client ip]  [ftp server ip]      21    ftp_cluster &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;91      &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;0&lt;/span&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;NOTE: This only works on vservers where persistence is handled by source-ip. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the case of HTTP traffic, you can add a header to ip with the original ip, in the http traffic that hits the backend services.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are also a number of Netscaler products allow you to do extensive log analysis.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-6503615183345157028?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/6503615183345157028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/how-to-trace-end-to-end-connections-on_31.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6503615183345157028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6503615183345157028'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/how-to-trace-end-to-end-connections-on_31.html' title='How to trace end-to-end connections on the Netscaler Load-balancer'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-4128060128487997517</id><published>2009-07-27T09:46:00.001-07:00</published><updated>2009-07-27T09:46:38.015-07:00</updated><title type='text'>Enabling Persistent Routes on a Debian Host</title><content type='html'>&lt;div&gt;1. su to root&lt;/div&gt;&lt;div&gt;2. cd to /etc/network/&lt;/div&gt;&lt;div&gt;3. Copy off the interfaces file to interfaces.DATE (or what have you)&lt;/div&gt;&lt;div&gt;4. Add lines of the following form under the primary network interface definition:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;up route add -net 10.1.1.0 netmask 255.255.255.0 gw 10.2.1.1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;down route del -net 10.1.1.0 netmask 255.255.255.0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So you should end up with something like this:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;iface bond0 inet static&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;address 10.2.1.5&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;netmask 255.255.255.0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;network 10.2.1.0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;gateway 10.2.1.1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;up /sbin/ifenslave bond0 eth0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;up /sbin/ifenslave bond0 eth2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;up route add -net 10.1.1.0 netmask 255.255.255.0 gw 10.2.1.1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;down route del -net 10.1.1.0 netmask 255.255.255.0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That creates a route to the 10.1.1.x network for the host with the ip 10.2.1.5 through the 10.2.1.1 router whenever the interface goes up. (It also removes it whenever the interface goes down.)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-4128060128487997517?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/4128060128487997517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/enabling-persistent-routes-on-debian.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4128060128487997517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4128060128487997517'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/enabling-persistent-routes-on-debian.html' title='Enabling Persistent Routes on a Debian Host'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-7254570088860586935</id><published>2009-07-27T09:30:00.000-07:00</published><updated>2009-07-27T09:33:15.350-07:00</updated><title type='text'>How to Disable and Clean Netapp Snapshots</title><content type='html'>&lt;div&gt;To disable snapshots on a netapp volume, you need to disable snapshots on the volume:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;vol options &lt;i&gt;volume_name&lt;/i&gt; &lt;volume&gt; nosnap on&lt;/volume&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and disable the automatically scheduled snaps&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;snap sched &lt;span class="Apple-style-span" style="font-family: 'courier new', -webkit-fantasy; font-style: italic; "&gt;volume_name &lt;span class="Apple-style-span" style="font-family: 'courier new', fantasy; font-style: normal; "&gt;0 0 0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you need to clear space from the snapshot volume, you can delete the old snaps.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Run&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;snap list &lt;volume&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', -webkit-fantasy; font-style: italic; "&gt;volume_name&lt;/span&gt;&lt;/volume&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;to find them, then&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;snap delete &lt;volume&gt;&lt;snap&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', -webkit-fantasy; font-style: italic; "&gt;volume_name snap_name&lt;/span&gt;&lt;/snap&gt;&lt;/volume&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;to delete them.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-7254570088860586935?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/7254570088860586935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/how-to-disable-and-clean-netapp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/7254570088860586935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/7254570088860586935'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/how-to-disable-and-clean-netapp.html' title='How to Disable and Clean Netapp Snapshots'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-22536874703055028</id><published>2009-07-17T10:09:00.000-07:00</published><updated>2009-07-17T10:14:08.053-07:00</updated><title type='text'>How To Use Netapp SnapMirror</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;I.  To Create a Snapmirror Relationship:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Create source and destination volumes of the same size that have a same-sized aggregate. (This is critical for being able to change the direction of the sync.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Go into &lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;i&gt;FilerView &gt; Volumes&lt;/i&gt;&lt;/span&gt; on the DESTINATION and mark the volume OFFLINE.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Go into &lt;i&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;FilerView &gt; SnapMirror &gt; Add&lt;/span&gt;&lt;/i&gt; on the DESTINATION and proceed through accepting all the defaults except, obviously, the volume names.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;On the &lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;i&gt;SnapMirror &gt; Manage&lt;/i&gt;&lt;/span&gt; screen, click the Advanced properties of the new job. Inside the job, click "Initialize". It will clean the target volume and begin the first sync. The sync will begin automatically on schedule which, if you used the defaults, is every minute.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;II.  To mark a Snapmirror RW:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;End the SnapMirror relationship with the&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;snapmirror break&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;command. This command changes the destination's status from&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;snapmirrored&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; to&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;broken-off&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; thus making it writable.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When you're ready to resync them, run the&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;snapmirror resync&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; command on the &lt;b&gt;DESTINATION&lt;/b&gt;. This will change a former destination's status back to snapmirrored and will resynchronize its contents with the source.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(NOTE: When applied to a former source, snapmirror resync can turn it into a mirror of the former destination. In this way, the roles of source and destination can be reversed.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;At any time, you can see the status of all the snapmirrors by running the&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;snapmirror list&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;command.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-22536874703055028?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/22536874703055028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/how-to-use-netapp-snapmirror.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/22536874703055028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/22536874703055028'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/how-to-use-netapp-snapmirror.html' title='How To Use Netapp SnapMirror'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-6183752221977667021</id><published>2009-07-02T06:29:00.000-07:00</published><updated>2009-07-02T06:31:55.621-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='books'/><title type='text'>Bookpool is gone!</title><content type='html'>How terribly, terribly sad!  I noticed their inventory had been pretty lean for a while there, but this was definitely the go-to site for at least half the books in my collection.  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I guess the web giveth and the web taketh away.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's hoping a new store rises from the ashes . . .&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-6183752221977667021?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/6183752221977667021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/bookpool-is-gone.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6183752221977667021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/6183752221977667021'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/07/bookpool-is-gone.html' title='Bookpool is gone!'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-713346619630239020</id><published>2009-06-26T16:10:00.000-07:00</published><updated>2009-06-26T16:16:53.108-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='exclude'/><category scheme='http://www.blogger.com/atom/ns#' term='find'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Prune - Find's tricky switch</title><content type='html'>After many thousands of uses, I finally got around to investigating find's exclusion parameters.  Showing its age, it basically consists of an arcane string of -path options combined with an -o for "or" followed by a -prune to indicate the need to exclude it from the search.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I was always sure there was some way to do it.  (With a regex, if nothing else.)  I've read the man page about 100 times and I've never understood how it worked till last week.  It works like a charm, in fact.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That being said, surely something closer to the du --exclude parameter is in order.  Features aren't very useful if people don't know they're there.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-713346619630239020?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/713346619630239020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/06/exclusions-finds-tricky-cousin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/713346619630239020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/713346619630239020'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/06/exclusions-finds-tricky-cousin.html' title='Prune - Find&apos;s tricky switch'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-4949313049091565875</id><published>2009-06-18T11:55:00.000-07:00</published><updated>2009-06-18T12:00:00.422-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='find'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>ctime vs mtime</title><content type='html'>So about that huge file cleanup . . .  it seems that Netapp's ndmpcopy resets all the files' ctimes.  (Meaning there were changes to the inodes somewhere in the process).  Fortunately, the mtimes were preserved so I was able to generate a proper distribution-over-time stat.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I can only assume (since the guy who ran the ndmpcopy swears he didn't do anything else), that that means ndmpcopy is actually creating the inodes on the fly rather copying the existing ones over.  Good to know.  (rsync preserves those stamps the way I usually run it, so I've never run into this issue before.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-4949313049091565875?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/4949313049091565875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/06/ctime-vs-mtime.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4949313049091565875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4949313049091565875'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/06/ctime-vs-mtime.html' title='ctime vs mtime'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-4946001715986700457</id><published>2009-06-16T07:13:00.001-07:00</published><updated>2009-06-16T07:19:30.273-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netapp'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>Multi-million-file Cleanup</title><content type='html'>I'm queuing up a series of scripts for tonight to go through the customer filesystems and clean out files older than a certain interval.  Under most circumstances, this would be a simple find and exec.  Once you get past about 400,000 files, though, you're forced to break the operation down into atomic tasks.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Essentially, I do a while-loop that descends to the level of customer directories and the performs the find within each one of them.  Normally, I would move the files to a trash directory at the root of the filesystem, but this is on the new netapps so a) this is mounted over NFS and moves would be extremely expensive and b) there's a built-in snapshotting capability in WAFL.  So I'll snap it first, then run the cleaner.  (On the plus side, I've been running this cleaner against our existing storage for years, so the basic algorithm is rock-solid.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-4946001715986700457?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/4946001715986700457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/06/multi-million-file-cleanup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4946001715986700457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/4946001715986700457'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/06/multi-million-file-cleanup.html' title='Multi-million-file Cleanup'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3238679741398030872.post-8945613427173854798</id><published>2009-06-15T10:39:00.000-07:00</published><updated>2009-06-15T10:41:47.122-07:00</updated><title type='text'>New Hosting Provider</title><content type='html'>I lost my last blog/troubleshooting matrix to a break-in at my last provider, so I'm giving JustHost a try.  It will be interesting to see how the domain transfer process has evolved over the last few years . . .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3238679741398030872-8945613427173854798?l=betterlivingthroughunix.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://betterlivingthroughunix.blogspot.com/feeds/8945613427173854798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/06/new-hosting-provider.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/8945613427173854798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3238679741398030872/posts/default/8945613427173854798'/><link rel='alternate' type='text/html' href='http://betterlivingthroughunix.blogspot.com/2009/06/new-hosting-provider.html' title='New Hosting Provider'/><author><name>Nathan McCourtney</name><uri>http://www.blogger.com/profile/17412395684389624626</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_0R-IOWiUVOM/SjaFhR1QKQI/AAAAAAAAZhM/vbgfT-3PPA0/S220/dinner.jpg'/></author><thr:total>0</thr:total></entry></feed>
