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

<channel>
	<title>making IT happen : an infrastructure blog &#187; Unix</title>
	<atom:link href="http://www.lanigera.com/wordpress/category/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lanigera.com/wordpress</link>
	<description>views from the trenches</description>
	<lastBuildDate>Mon, 23 Jan 2012 21:41:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Easy thumbnails of PDFs on OS X</title>
		<link>http://www.lanigera.com/wordpress/2012/01/easy-thumbnails-of-pdfs-on-os-x/</link>
		<comments>http://www.lanigera.com/wordpress/2012/01/easy-thumbnails-of-pdfs-on-os-x/#comments</comments>
		<pubDate>Sat, 07 Jan 2012 04:42:43 +0000</pubDate>
		<dc:creator>tkyle</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[sips]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.lanigera.com/wordpress/?p=536</guid>
		<description><![CDATA[I recently needed to create some thumbnails, using the first page of a fairly large number of PDFs. I was pleasantly surprised to learn that OS X has a handy command-line utility that can be easily scripted to do this. Here&#8217;s the one-liner I used to accomplish the task: for file in `echo *.pdf`; do [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to create some thumbnails, using the first page of a fairly large number of PDFs.  I was pleasantly surprised to learn that OS X has a handy command-line utility that can be easily scripted to do this.  Here&#8217;s the one-liner I used to accomplish the task:</p>

<div class="wp_syntax"><div class="code"><pre class="script" style="font-family:monospace;">for file in `echo *.pdf`; do sips -s format jpeg --resampleWidth 540 \
$file --out `basename $file .pdf`_thumb.jpg; done</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.lanigera.com/wordpress/2012/01/easy-thumbnails-of-pdfs-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a CentOS repository</title>
		<link>http://www.lanigera.com/wordpress/2011/07/setting-up-a-centos-repository/</link>
		<comments>http://www.lanigera.com/wordpress/2011/07/setting-up-a-centos-repository/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 21:55:52 +0000</pubDate>
		<dc:creator>tkyle</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mirror]]></category>
		<category><![CDATA[repository]]></category>

		<guid isPermaLink="false">http://www.lanigera.com/wordpress/?p=383</guid>
		<description><![CDATA[To celebrate the release (finally!) of CentOS 6, here&#8217;s how to create a local repository and keep it up-to-date. The first step is to create the directory structure for the repository.  You&#8217;ll need about 30GB of free space in the filesystem you use.  Let&#8217;s assume we have a mountpoint /repo that we want to use: [...]]]></description>
			<content:encoded><![CDATA[<p>To celebrate the release (finally!) of CentOS 6, here&#8217;s how to create a local repository and keep it up-to-date.</p>
<!-- tweet id : 90132772496211968 --><style type='text/css'>#bbpBox_90132772496211968 a { text-decoration:none; color:#009999; }#bbpBox_90132772496211968 a:hover { text-decoration:underline; }</style><div id='bbpBox_90132772496211968' class='bbpBox' style='padding:20px; margin:5px 0; background-color:#131516; background-image:url(http://a1.twimg.com/images/themes/theme14/bg.gif);'><div style='background:#fff; padding:10px; margin:0; min-height:48px; color:#333333; -moz-border-radius:5px; -webkit-border-radius:5px;'><span style='width:100%; font-size:18px; line-height:22px;'>CentOS-6.0 is now released { <a href="http://t.co/zAlkelc" rel="nofollow">http://t.co/zAlkelc</a> }; Enjoy!</span><div class='bbp-actions' style='font-size:12px; width:100%; padding:5px 0; margin:0 0 10px 0; border-bottom:1px solid #e6e6e6;'><img align='middle' src='http://www.lanigera.com/wordpress/wp-content/plugins/twitter-blackbird-pie//images/bird.png' /><a title='tweeted on July 10, 2011 1:58 pm' href='http://twitter.com/#!/CentOS/status/90132772496211968' target='_blank'>July 10, 2011 1:58 pm</a> via web<a href='https://twitter.com/intent/tweet?in_reply_to=90132772496211968' class='bbp-action bbp-reply-action' title='Reply'><span><em style='margin-left: 1em;'></em><strong>Reply</strong></span></a><a href='https://twitter.com/intent/retweet?tweet_id=90132772496211968' class='bbp-action bbp-retweet-action' title='Retweet'><span><em style='margin-left: 1em;'></em><strong>Retweet</strong></span></a><a href='https://twitter.com/intent/favorite?tweet_id=90132772496211968' class='bbp-action bbp-favorite-action' title='Favorite'><span><em style='margin-left: 1em;'></em><strong>Favorite</strong></span></a></div><div style='float:left; padding:0; margin:0'><a href='http://twitter.com/intent/user?screen_name=CentOS'><img style='width:48px; height:48px; padding-right:7px; border:none; background:none; margin:0' src='http://a3.twimg.com/profile_images/63840041/centoslogo-64_normal.png' /></a></div><div style='float:left; padding:0; margin:0'><a style='font-weight:bold' href='http://twitter.com/intent/user?screen_name=CentOS'>@CentOS</a><div style='margin:0; padding-top:2px'>Karanbir Singh</div></div><div style='clear:both'></div></div></div><!-- end of tweet -->
<p>The first step is to create the directory structure for the repository.  You&#8217;ll need about 30GB of free space in the filesystem you use.  Let&#8217;s assume we have a mountpoint /repo that we want to use:</p>
<pre style="padding-left: 30px;">mkdir -p /repo/CentOS/6/addons/i386 /repo/CentOS/6/extras/i386 /repo/CentOS/6/isos/i386 \
        /repo/CentOS/6/os/i386 /repo/CentOS/6/updates/i386  \
        /repo/CentOS/6/addons/x86_64 /repo/CentOS/6/extras/x86_64 \
        /repo/CentOS/6/isos/x86_64 /repo/CentOS/6/os/x86_64 \
        /repo/CentOS/6/updates/x86_64</pre>
<p>If you&#8217;d like to mirror other releases (such as CentOS 5), you&#8217;ll also need to create the directory structure for those as well.</p>
<p>Once the directory structure is in place, we can use rsync to pull down what we don&#8217;t have.  I&#8217;ve written a simple script to do this.  Since this is a new repository, the first run will pull down everything, so it might be best run overnight.  Also, note that I am mirroring both CentOS 5 and CentOS 6 in this script.  Simply remove 5 from the verlist if you only want to mirror CentOS 6.  The same applies for i386 in the archlist.</p>
<pre style="padding-left: 30px;">#!/bin/sh

rsync="/usr/bin/rsync -aqHz --delete"
mirror=us-msync.centos.org::CentOS

verlist="5 6"
archlist="i386 x86_64"
baselist="os updates addons extras isos"
local=/repo/CentOS

for ver in $verlist
do
  for arch in $archlist
  do
    for base in $baselist
    do
        remote=$mirror/$ver/$base/$arch/
        $rsync $remote $local/$ver/$base/$arch/
    done
  done
done</pre>
<p>Since your yum clients will be accessing the repository via HTTP, you&#8217;ll need to setup a webserver.  Here, I&#8217;m using the standard Apache httpd that comes with CentOS.  Simply modify the following lines in /etc/httpd/conf/httpd.conf:</p>
<pre style="padding-left: 30px;">#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/repo"
.</pre>
<pre style="padding-left: 30px;">.</pre>
<pre style="padding-left: 30px;">.</pre>
<pre style="padding-left: 30px;">#
# This should be changed to whatever you set DocumentRoot to.
#
&lt;Directory "/repo"&gt;</pre>
<p>After reconfiguring Apache, start it up.  If everything works correctly, ensure that it will start at boot with chkconfig.</p>
<pre style="padding-left: 30px;">[dood@mirror ~]$ sudo /sbin/service httpd start
[dood@mirror ~]$ sudo /sbin/chkconfig httpd on</pre>
<p>The last step is configuring your clients.  This can be done either through editing /etc/yum.conf, or adding to /etc/yum.repos.d:</p>
<pre style="padding-left: 30px;">[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.lanigera.com/CentOS/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.lanigera.com/CentOS/RPM-GPG-KEY-CentOS-6
enabled=1

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirror.lanigera.com/CentOS/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.lanigera.com/CentOS/RPM-GPG-KEY-CentOS-6
enabled=1

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://mirror.lanigera.com/CentOS/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.lanigera.com/CentOS/RPM-GPG-KEY-CentOS-6
enabled=1

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirror.lanigera.com/CentOS/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.lanigera.com/CentOS/RPM-GPG-KEY-CentOS-6
enabled=1

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=centosplus
baseurl=http://mirror.lanigera.com/CentOS/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.lanigera.com/CentOS/RPM-GPG-KEY-CentOS-6</pre>
<p>There you go.  Cron the repo script to run daily, and you should be good.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanigera.com/wordpress/2011/07/setting-up-a-centos-repository/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using dmidecode on Linux to find host information</title>
		<link>http://www.lanigera.com/wordpress/2011/06/using-dmidecode-on-linux-to-find-host-information/</link>
		<comments>http://www.lanigera.com/wordpress/2011/06/using-dmidecode-on-linux-to-find-host-information/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 16:34:53 +0000</pubDate>
		<dc:creator>tkyle</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[dmidecode]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[serial number]]></category>
		<category><![CDATA[service tag]]></category>

		<guid isPermaLink="false">http://www.lanigera.com/wordpress/?p=337</guid>
		<description><![CDATA[A handy utility that I use frequently to find information on my systems is dmidecode.  We run Dell PowerEdges, and I frequently need to find the Service Tag for licensing, support, and whatnot.  The utility is a way to get information on the system BIOS, firmware versions, etc. With dmidecode, I can get this information [...]]]></description>
			<content:encoded><![CDATA[<p>A handy utility that I use frequently to find information on my systems is <strong>dmidecode</strong>.  We run Dell PowerEdges, and I frequently need to find the Service Tag for licensing, support, and whatnot.  The utility is a way to get information on the system BIOS, firmware versions, etc.</p>
<p>With dmidecode, I can get this information with a simple, one-line command:</p>
<pre style="padding-left: 30px;"># /usr/sbin/dmidecode|grep 'Serial Number'|head -1</pre>
<pre style="padding-left: 30px;">                Serial Number: ABC1234</pre>
<p><span id="more-337"></span>You can also page through the output to get the model number of the system.  I showed this to our DBA yesterday, so that he could know which systems a client had upgraded to.  As you can see, this system is a PowerEdge 6850:</p>
<pre style="padding-left: 30px;"># /usr/sbin/dmidecode |more</pre>
<pre style="padding-left: 30px;">[blah blah blah]</pre>
<pre style="padding-left: 30px;">Handle 0x0100</pre>
<pre style="padding-left: 30px;">        DMI type 1, 25 bytes.</pre>
<pre style="padding-left: 30px;">        System Information</pre>
<pre style="padding-left: 30px;">                Manufacturer: Dell Computer Corporation</pre>
<pre style="padding-left: 30px;">                Product Name: PowerEdge 6850</pre>
<pre style="padding-left: 30px;">                Version: Not Specified</pre>
<pre style="padding-left: 30px;">                Serial Number: ABC1234</pre>
<pre style="padding-left: 30px;">                UUID: 11122222-3333-4444-5555-666666777777</pre>
<pre style="padding-left: 30px;">                Wake-up Type: Power Switch</pre>
<p>There&#8217;s a lot more information returned by dmidecode than I&#8217;ve covered here.  Also, the version included in RHEL 4 does not seem to take any arguments, nor does it have a manpage.  Peeking at CentOS 5, it does accept several arguments (and there&#8217;s actually a manpage, hooray!).  YMMV.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanigera.com/wordpress/2011/06/using-dmidecode-on-linux-to-find-host-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Directory Authentication in Tomcat 6</title>
		<link>http://www.lanigera.com/wordpress/2011/02/active-directory-authentication-in-tomcat-6/</link>
		<comments>http://www.lanigera.com/wordpress/2011/02/active-directory-authentication-in-tomcat-6/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 05:10:04 +0000</pubDate>
		<dc:creator>tkyle</dc:creator>
				<category><![CDATA[Application Servers]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[ad]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[application server]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.lanigera.com/wordpress/?p=258</guid>
		<description><![CDATA[Note: Here&#8217;s a writeup that I did about two years ago, but should still be valid for Tomcat 6. Active Directory Configuration Create an account in Active Directory to be used for enumerating users and groups.  Active Directory does not allow anonymous binds. Tomcat Configuration These instructions assume that you are modifying a clean install [...]]]></description>
			<content:encoded><![CDATA[<p><em>Note: Here&#8217;s a writeup that I did about two years ago, but should still be valid for Tomcat 6.</em></p>
<h2>Active Directory Configuration</h2>
<p>Create an account in Active Directory to be used for enumerating users and groups.  Active Directory does not allow anonymous binds.</p>
<h2>Tomcat Configuration</h2>
<p>These instructions assume that you are modifying a clean install of Tomcat 6.0.</p>
<p>First, the JNDI Realm must be configured in the main Tomcat configuration file ($CATALINA_HOME/conf/server.xml).  This defines the LDAP connection to Active Directory.  Next, access controls are configured within the context, or application, configuration file ($WEB_APP/WEB-INF/web.xml).</p>
<h3>Define Realm in $CATALINA_HOME/conf/server.xml</h3>
<p>Comment out the UserDatabase Realm:</p>
<pre style="padding-left: 30px;">&lt;!--
    &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm"
           resourceName="UserDatabase"/&gt;
--&gt;</pre>
<p>Add a Realm definition for the LDAP connection:</p>
<pre style="padding-left: 30px;">&lt;Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
       connectionURL="ldap://companydc1:389"
       alternateURL="ldap://companydc2:389"
       connectionName="BIND_USER@company.com"
       connectionPassword="BIND_PASSWD"
       referrals="follow"
       userBase="dc=company,dc=com"
       userSearch="(sAMAccountName={0})"
       userSubtree="true" roleBase="dc=company,dc=com"
       roleName="cn"
       roleSearch="(member={0})"
       roleSubtree="true"
/&gt;</pre>
<h3>Define Context Security Settings in web.xml</h3>
<p>Edit the web.xml configuration file of the context (application) you want to secure, modifying the url-pattern, http-method, auth-method, and role-name tags as needed:</p>
<pre style="padding-left: 30px;">&lt;security-constraint&gt;
  &lt;display-name&gt;Example Security Constraint&lt;/display-name&gt;
  &lt;web-resource-collection&gt;
    &lt;web-resource-name&gt;Protected Area&lt;/web-resource-name&gt;
    &lt;!-- Define the context-relative URL(s) to be protected --&gt;
    &lt;url-pattern&gt;/PATH_TO_WEBAPP/*&lt;/url-pattern&gt;
    &lt;!-- If you list http methods, only those methods are protected --&gt;
    &lt;http-method&gt;DELETE&lt;/http-method&gt;
    &lt;http-method&gt;GET&lt;/http-method&gt;
    &lt;http-method&gt;POST&lt;/http-method&gt;
    &lt;http-method&gt;PUT&lt;/http-method&gt;
  &lt;/web-resource-collection&gt;
  &lt;auth-constraint&gt;
    &lt;!-- Anyone with one of the listed roles may access this area --&gt;
    &lt;role-name&gt;ACTIVE_DIRECTORY_GROUP&lt;/role-name&gt;
  &lt;/auth-constraint&gt;
&lt;/security-constraint&gt;

&lt;!-- Default login configuration uses form-based authentication --&gt;
&lt;login-config&gt;
  &lt;auth-method&gt;FORM&lt;/auth-method&gt;
  &lt;realm-name&gt;Example Form-Based Authentication Area&lt;/realm-name&gt;
  &lt;form-login-config&gt;
    &lt;form-login-page&gt;/jsp/security/protected/login.jsp&lt;/form-login-page&gt;
    &lt;form-error-page&gt;/jsp/security/protected/error.jsp&lt;/form-error-page&gt;
  &lt;/form-login-config&gt;
&lt;/login-config&gt;

&lt;!-- Security roles referenced by this web application --&gt;
&lt;security-role&gt;
  &lt;role-name&gt;ACTIVE_DIRECTORY_GROUP&lt;/role-name&gt;
&lt;/security-role&gt;</pre>
<p>Note that multiple roles can be specified, and that roles are equivalent to groups in Active Directory.</p>
<h2>Applying</h2>
<p>Restart Tomcat for your changes to take effect.</p>
<pre style="padding-left: 30px;"># bin/shutdown.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.14/temp
Using JRE_HOME:       /usr/java/jdk1.5.0_13</pre>
<p>Wait for the java process to exit – this can take 10 to 15 seconds:</p>
<pre style="padding-left: 30px;"># ps -ef|grep java
root     26858     1 47 10:00 pts/2    00:00:15 /usr/java/jdk1.5.0_13/bin/java
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.
logging.config.file=/usr/local/apache-tomcat-6.0.14/conf/logging.properties -D
java.endorsed.dirs=/usr/local/apache-tomcat-6.0.14/endorsed -classpath :/usr/l
ocal/apache-tomcat-6.0.14/bin/bootstrap.jar:/usr/local/apache-tomcat-6.0.14/bi
n/commons-logging-api.jar -Dcatalina.base=/usr/local/apache-tomcat-6.0.14 -Dca
talina.home=/usr/local/apache-tomcat-6.0.14 -Djava.io.tmpdir=/usr/local/apache
-tomcat-6.0.14/temp org.apache.catalina.startup.Bootstrap start
# ps -ef|grep java
root     26951 19329  0 10:01 pts/2    00:00:00 grep java</pre>
<p>After the process has ended, start Tomcat again:</p>
<pre style="padding-left: 30px;"># bin/startup.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.14/temp
Using JRE_HOME:       /usr/java/jdk1.5.0_13</pre>
<p>If you received errors on startup, shutdown Tomcat again, and double-check your changes.</p>
<h2>Testing</h2>
<p>After restarting Tomcat, open a web browser, and go to a protected URL that you just configured.  You should be prompted to enter a username and password.  Login with an account that has a role that you specified in the web.xml file, and you should be able to access the context.</p>
<h2>References</h2>
<p><a href="http://tomcat/docs/realm-howto.html">http://tomcat/docs/realm-howto.html</a> or <a href="http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html">http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html</a></p>
<p><a href="http://cymulacrum.net/writings/adv_tomcat/c487.html">http://cymulacrum.net/writings/adv_tomcat/c487.html</a></p>
<p><a href="http://www.cafesoft.com/products/cams/tomcat-security.html">http://www.cafesoft.com/products/cams/tomcat-security.html</a></p>
<p><a href="http://wiki.apache.org/tomcat/JNDI_HowTo">http://wiki.apache.org/tomcat/JNDI_HowTo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanigera.com/wordpress/2011/02/active-directory-authentication-in-tomcat-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux and free memory</title>
		<link>http://www.lanigera.com/wordpress/2011/02/linux-and-free-memory/</link>
		<comments>http://www.lanigera.com/wordpress/2011/02/linux-and-free-memory/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 01:24:23 +0000</pubDate>
		<dc:creator>tkyle</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[dirty]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[meminfo]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://www.lanigera.com/wordpress/?p=250</guid>
		<description><![CDATA[How much memory really is free on a Linux system, anyway? This is something that I have seen cause confusion in the past. A DBA, developer, or consultant is trying to figure out why a particular application or program is running poorly (it&#8217;s never, ever their Java or SQL code), runs top or free, sees [...]]]></description>
			<content:encoded><![CDATA[<p>How much memory really is free on a Linux system, anyway?</p>
<p>This is something that I have seen cause confusion in the past. A  DBA, developer, or consultant is trying to figure out why a particular  application or program is running poorly (it&#8217;s never, ever their Java or  SQL code), runs top or free, sees very little free memory, and jumps to  the conclusion that the system is out of memory.  And the buck is  inevitably passed.  To you.</p>
<p>So, how the heck do you find out how much memory is *really* being used?  One way is to view /proc/meminfo:</p>
<pre style="padding-left: 30px;">MemTotal:     32904572 kB
MemFree:         92028 kB
Buffers:        196172 kB
Cached:       24069564 kB
SwapCached:        336 kB
Active:       20241392 kB
Inactive:      9761156 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:     32904572 kB
LowFree:         92028 kB
SwapTotal:    22020088 kB
SwapFree:     21883304 kB
Dirty:             392 kB
Writeback:           0 kB
Mapped:        9632036 kB
Slab:           569292 kB
CommitLimit:  38472372 kB
Committed_AS: 14082748 kB
PageTables:    2170840 kB
VmallocTotal: 536870911 kB
VmallocUsed:    276288 kB
VmallocChunk: 536594487 kB
HugePages_Total:     0
HugePages_Free:      0
Hugepagesize:     2048 kB
</pre>
<p>As we can see, the system has 32 GB of memory, but less than 90MB of  &#8220;free&#8221; memory.  Oh noes!  But as with most things Unix, if you  understand what&#8217;s going on, this all makes quite a bit more sense.   Let&#8217;s zero in on a few, key numbers here:</p>
<pre style="padding-left: 30px;">MemTotal:     32904572 kB</pre>
<p>This is the total amount of memory in the system.  Pretty straightforward.</p>
<pre style="padding-left: 30px;">Active:       20241392 kB</pre>
<p>This is the amount of memory actively being used by the system, in  this case just less than 20 GB.  Notice that subtracting this number  from the total does not equal the following:</p>
<pre style="padding-left: 30px;">MemFree:         92028 kB</pre>
<p>So if memory&#8217;s not actively being used, and it&#8217;s not free, then what  the heck is going on?  Part of it is that the Linux kernel is being  smart and keeping things in memory that it was using, but isn&#8217;t now.   That way, in case you need the data again, it is sitting there in nice,  fast memory instead of on slow disk.</p>
<pre style="padding-left: 30px;">Inactive:      9761156 kB</pre>
<p>&#8220;Inactive&#8221; memory is memory that hasn&#8217;t been recently used and is  eligible for cleaning.  But for now, it&#8217;s being used as a cache and also  to confuse your dev team.</p>
<pre style="padding-left: 30px;">Dirty:             392 kB</pre>
<p>&#8220;Dirty&#8221; memory is memory that doesn&#8217;t match what&#8217;s on disk and probably needs to be flushed.</p>
<p>For further reading, see Red Hat Magazine, &#8220;<a href="http://www.redhat.com/magazine/001nov04/features/vm/">Understanding Virtual Memory</a>.&#8221;  It&#8217;s for RHEL 3, but probably still fairly accurate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanigera.com/wordpress/2011/02/linux-and-free-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Career options for Unix admins</title>
		<link>http://www.lanigera.com/wordpress/2011/02/career-options/</link>
		<comments>http://www.lanigera.com/wordpress/2011/02/career-options/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 04:43:51 +0000</pubDate>
		<dc:creator>tkyle</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Musings]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[banjo]]></category>
		<category><![CDATA[beard]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[trains]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.lanigera.com/wordpress/?p=196</guid>
		<description><![CDATA[Let&#8217;s see - Overalls?  Check Huge beard?  Check Plus sized? Check &#8220;Big Iron&#8221; enthusiast?  Check Yeah, I think there&#8217;s a good chance this guy is a fellow Unix admin.  Good to know we have career options!]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s see -</p>
<p>Overalls?  <em>Check</em></p>
<p>Huge beard?  <em>Check</em></p>
<p>Plus sized? <em>Check</em></p>
<p>&#8220;Big Iron&#8221; enthusiast?  <em>Check</em></p>
<p>Yeah, I think there&#8217;s a good chance this guy is a fellow Unix admin.  Good to know we have career options!</p>
<p style="text-align: center;"><div class="videoContainer"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/MbkS0MeujiI" /><div class="videoContainer"><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/MbkS0MeujiI"></embed></div></object></div></p>
<p style="text-align: left;">
]]></content:encoded>
			<wfw:commentRss>http://www.lanigera.com/wordpress/2011/02/career-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux kiosk for Oracle MSCA</title>
		<link>http://www.lanigera.com/wordpress/2009/11/linux-kiosk-for-oracle-msca/</link>
		<comments>http://www.lanigera.com/wordpress/2009/11/linux-kiosk-for-oracle-msca/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 16:46:38 +0000</pubDate>
		<dc:creator>tkyle</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.lanigera.com/wordpress/?p=57</guid>
		<description><![CDATA[Recently, I was asked to explore building a kiosk image for use in our manufacturing facilities.Â All the system would need to do would be to allow the user to telnet into an Oracle MSCA/MWA service.Â I thought going in that this would be a straightforward task, but it turned out to be more complicated [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I was asked to explore building a kiosk image for use in our manufacturing facilities.Â  All the system would need to do would be to allow the user to telnet into an Oracle MSCA/MWA service.Â  I thought going in that this would be a straightforward task, but it turned out to be more complicated than I realized.</p>
<p>There were two problems that I was experiencing. The first was that F1-F4 were mapped differently, for what appears to be historical reasons (VT100 terminals did not have these keys). The other was that the telnet client needed to be in character mode, instead of line mode, and there was no easy way to do this in the Linux <strong>telnet</strong> client except through the user manually changing the mode.</p>
<p>So I used Expect to translate the F1-F4 keys to what the remote MSCA telnet server wanted, and then used C-Kermit as my telnet client. The scripts I wrote to perform these two steps are as follows:</p>
<p>[shell]<br />
 #!/usr/local/bin/kermit</p>
<p> set telnet newline-mode nvt raw<br />
 set telnet echo remote</p>
<p> telnet /nowait host.company.com 12345</p>
<p> quit<br />
[/shell]</p>
<p>and</p>
<p>[shell]<br />
 #!/usr/bin/expect</p>
<p> eval spawn -noecho &quot;/usr/local/bin/ktelnet.sh&quot;</p>
<p> interact {<br />
 &quot;\033[[A&quot; { send &quot;\033[P&quot; }<br />
 &quot;\033[[B&quot; { send &quot;\033[Q&quot; }<br />
 &quot;\033[[C&quot; { send &quot;\033[R&quot; }<br />
 &quot;\033[[D&quot; { send &quot;\033[S&quot; }<br />
 }<br />
[/shell]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanigera.com/wordpress/2009/11/linux-kiosk-for-oracle-msca/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: lanigera.com @ 2012-02-07 16:55:21 -->
