<?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>www.jhodges.co.uk &#187; Bash</title>
	<atom:link href="http://jhodges.co.uk/category/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://jhodges.co.uk</link>
	<description>I ain&#039;t not never done nothing to nobody and there ain&#039;t not no way none of that couldn&#039;t not never have happened. See?</description>
	<lastBuildDate>Tue, 08 Jun 2010 20:34:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Recursively find the latest modified file</title>
		<link>http://jhodges.co.uk/recursively-find-the-latest-modified-file/</link>
		<comments>http://jhodges.co.uk/recursively-find-the-latest-modified-file/#comments</comments>
		<pubDate>Thu, 27 May 2010 10:10:54 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://jhodges.co.uk/recursively-find-the-latest-modified-file/</guid>
		<description><![CDATA[find . -printf "%CY-%Cm-%Cd %CH:%CM:%CS\t%p\n" &#124; sort -nr &#124; head -n 1
]]></description>
			<content:encoded><![CDATA[<p><code>find . -printf "%CY-%Cm-%Cd %CH:%CM:%CS\t%p\n" | sort -nr | head -n 1</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/recursively-find-the-latest-modified-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Count unique IP address in Apache&#8217;s access log</title>
		<link>http://jhodges.co.uk/count-unique-ip-address-in-apaches-access-log/</link>
		<comments>http://jhodges.co.uk/count-unique-ip-address-in-apaches-access-log/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 23:14:43 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.jhodges.co.uk/count-unique-ip-address-in-apaches-access-log/</guid>
		<description><![CDATA[sed < /var/log/httpd/access_log -e 's/ .*$//' &#124; sort &#124; uniq -c
]]></description>
			<content:encoded><![CDATA[<pre>sed < /var/log/httpd/access_log -e 's/ .*$//' | sort | uniq -c</pre>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/count-unique-ip-address-in-apaches-access-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List files/folders ordered by size</title>
		<link>http://jhodges.co.uk/list-files-foloders-ordered-by-size/</link>
		<comments>http://jhodges.co.uk/list-files-foloders-ordered-by-size/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 11:13:45 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.jhodges.co.uk/?p=47</guid>
		<description><![CDATA[du -s * &#124; sort -n
]]></description>
			<content:encoded><![CDATA[<pre style="color:#000080">du -s * | sort -n</pre>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/list-files-foloders-ordered-by-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash script to retry failed command</title>
		<link>http://jhodges.co.uk/bash-script-to-retry-failed-command/</link>
		<comments>http://jhodges.co.uk/bash-script-to-retry-failed-command/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 14:09:48 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.jhodges.co.uk/?p=72</guid>
		<description><![CDATA[This was originally developed to retry an rsync command if a network error happened. It&#8217;s a mishmash of code found from around the net, and could probably be tidier but it gets the job done.


function retry {
   nTrys=0
   maxTrys=5
   status=256
   until [ $status == 0 ] ; [...]]]></description>
			<content:encoded><![CDATA[<p>This was originally developed to retry an rsync command if a network error happened. It&#8217;s a mishmash of code found from around the net, and could probably be tidier but it gets the job done.</p>
<p><span id="more-72"></span>
<pre style="color: #000080;" language="PHP">
function retry {
   nTrys=0
   maxTrys=5
   status=256
   until [ $status == 0 ] ; do
      $1
      status=$?
      nTrys=$(($nTrys + 1))
      if [ $nTrys -gt $maxTrys ] ; then
            echo "Number of re-trys exceeded. Exit code: $status"
            exit $status
      fi
      if [ $status != 0 ] ; then
            echo "Failed (exit code $status)... retry $nTrys"
            sleep 300
      fi
   done
}
</pre>
<p>usage:</p>
<p>retry &#8220;echo success&#8221;<br />
retry &#8220;cat /failed/&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/bash-script-to-retry-failed-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
