<?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>dev.enekoalonso.com &#187; shell</title>
	<atom:link href="http://dev.enekoalonso.com/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.enekoalonso.com</link>
	<description>having fun with code</description>
	<lastBuildDate>Sat, 31 Jul 2010 05:51:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Check your server status with email notification</title>
		<link>http://dev.enekoalonso.com/2009/01/03/check-your-server-status-with-email-notification/</link>
		<comments>http://dev.enekoalonso.com/2009/01/03/check-your-server-status-with-email-notification/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 19:34:11 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[automatically]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[check]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[status]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=238</guid>
		<description><![CDATA[I wanted to do this for a while and never really sit down and code it. Yesterday I came across this pretty nice script by Ben from Coderholic which does exactly that: check your server status and send you an email if it is other than 200 (OK). #!/bin/bash &#160; &#160; # Query a supplied [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to do this for a while and never really sit down and code it. Yesterday I came across this pretty nice <a href="http://www.coderholic.com/server-status-checker-shell-script-2/">script by Ben from Coderholic</a> which does exactly that: check your server status and send you an email if it is other than 200 (OK).</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0">#!/bin/bash &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Query a supplied URL and output an error message if &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># the status code was not 200. Can be used as a cron &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># task to check if a server is up or not. &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Ben Dowling &#8211; http://www.coderholic.com &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># The URL to query &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re4">$#</span> -ne <span class="nu0">1</span> <span class="br0">&#93;</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">then</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">echo</span> <span class="st0">&quot;Usage: $0 &lt;URL&gt;&quot;</span>; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">exit</span>; &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">fi</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="re2">url=</span>$<span class="nu0">1</span>; &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re2">response=</span>$<span class="br0">&#40;</span>curl -s -I -L <span class="re1">$url</span> <span class="sy0">|</span> <span class="kw2">grep</span> HTTP<span class="br0">&#41;</span>; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="re2">status=</span>$<span class="br0">&#123;</span>response<span class="co0">#* }; # Strip off characters up to the first space &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">status=</span>$<span class="br0">&#123;</span>status:<span class="nu0">0</span>:<span class="nu0">3</span><span class="br0">&#125;</span>; <span class="co0"># Just use the 3 digit status code &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;$status&quot;</span> <span class="sy0">!</span>= <span class="st0">&quot;200&quot;</span> <span class="br0">&#93;</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">then</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">echo</span> <span class="st0">&quot;Error fetching $url. Status code &#39;$status&#39;&quot;</span>; &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">fi</span></div>
</li>
</ol>
</div>
<p>Nice.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>May 22, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/22/more-websockets-now-with-python/" title="More WebSockets, now with Python!">More WebSockets, now with Python!</a> (1)</li><li>May 16, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/16/performance-matters/" title="Performance matters">Performance matters</a> (2)</li><li>May 3, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/03/playing-with-websockets/" title="Playing with WebSockets">Playing with WebSockets</a> (2)</li><li>February 6, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/06/got-nfs-working/" title="Got NFS working">Got NFS working</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2009/01/03/check-your-server-status-with-email-notification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling PHP5 on Mac OS X Leopard</title>
		<link>http://dev.enekoalonso.com/2008/12/05/enabling-php5-on-mac-os-x-leopard/</link>
		<comments>http://dev.enekoalonso.com/2008/12/05/enabling-php5-on-mac-os-x-leopard/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 05:07:43 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=85</guid>
		<description><![CDATA[I had done this already at work, but for some reason my MacBook Pro still didn&#8217;t &#8220;understand&#8221; PHP. Well, I&#8217;ve decided it&#8217;s time to activate it: # Use your favorite editor mate /etc/apache2/httpd.conf # Uncomment the line: #LoadModule php5_module libexec/apache2/libphp5.so # Restart apache sudo apachectl restart Done. Related Posts:January 31, 2010 -- CloudServers: Creating a [...]]]></description>
			<content:encoded><![CDATA[<p>I had done this already at work, but for some reason my MacBook Pro still didn&#8217;t &#8220;understand&#8221; PHP. Well, I&#8217;ve decided it&#8217;s time to activate it:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0"># Use your favorite editor</span></div>
</li>
<li class="li1">
<div class="de1">mate <span class="sy0">/</span>etc<span class="sy0">/</span>apache2<span class="sy0">/</span>httpd.conf</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Uncomment the line:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#LoadModule php5_module libexec/apache2/libphp5.so</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Restart apache</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> apachectl restart</div>
</li>
</ol>
</div>
<p>Done.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 31, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-web-server-with-httpd-php-memcached/" title="CloudServers: Creating a new web server with httpd, php &#038; memcached">CloudServers: Creating a new web server with httpd, php &#038; memcached</a> (1)</li><li>July 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/07/30/titanium-developer-love-and-hate/" title="Titanium Developer: love and hate">Titanium Developer: love and hate</a> (2)</li><li>January 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/30/got-new-servers-on-rackspace-cloud/" title="Got new servers on Rackspace Cloud">Got new servers on Rackspace Cloud</a> (5)</li><li>March 1, 2009 -- <a href="http://dev.enekoalonso.com/2009/03/01/safari-4-rocks/" title="Safari 4 rocks">Safari 4 rocks</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2008/12/05/enabling-php5-on-mac-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
