<?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>BASH Cures Cancer &#187; Ideas</title>
	<atom:link href="http://bashcurescancer.com/category/ideas/feed" rel="self" type="application/rss+xml" />
	<link>http://bashcurescancer.com</link>
	<description>Learn the UNIX/Linux command line</description>
	<lastBuildDate>Tue, 25 Oct 2011 18:09:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Exposing command line programs as web services</title>
		<link>http://bashcurescancer.com/exposing-command-line-programs-as-web-services.html</link>
		<comments>http://bashcurescancer.com/exposing-command-line-programs-as-web-services.html#comments</comments>
		<pubDate>Thu, 27 Mar 2008 23:01:30 +0000</pubDate>
		<dc:creator>Brock Noland</dc:creator>
				<category><![CDATA[guest post]]></category>
		<category><![CDATA[Ideas]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://bashcurescancer.com/exposing-command-line-programs-as-web-services.html</guid>
		<description><![CDATA[The web services paradigm of development is based on the Unix philosophy of &#8220;small is good&#8221;.  Web services should do one job, and do it well, allowing users to develop complex solutions by combining small, reliable and proven services. Why not then, expose the power of familiar Unix commands like sort, grep, gzip&#8230; to the [...]]]></description>
			<content:encoded><![CDATA[<p>The web services paradigm of development is based on the Unix philosophy of &#8220;small is good&#8221;.  Web services should do one job, and do it well, allowing users to develop complex solutions by combining small, reliable and proven services.<br />
Why not then, expose the power of familiar Unix commands like sort, grep, gzip&#8230; to the web?</p>
<p>Here is a <a href="http://bashcurescancer.com/media/scripts/to_web.py.txt">proof of concept python script</a> (<a href="http://bashcurescancer.com/media/scripts/to_web2_3.py.txt">Python 2.3 version</a>) to demonstrate.</p>
<p><span style="font-family: arial,helvetica,sans-serif;">Start services:</span></p>
<pre><span style="font-family: courier new,monospace;">$ ./to_web.py -p8008 sort &amp;
Thu Mar 27 13:45:54 2008 sort server started - 8008</span><span style="font-family: courier new,monospace;">
$ ./to_web.py -p8009 gzip &amp;
Thu Mar 27 13:46:29 2008 gzip server started - 8009</span></pre>
<p><span style="font-family: courier new,monospace;"><span style="font-family: arial,helvetica,sans-serif;">Use the services:</span><br />
</span></p>
<pre><span style="font-family: courier new,monospace;">$ for i in {1..10}; do echo ${RANDOM:0:2}; done | \
&gt; curl --data-binary @- "<a href="http://swat:8008/sort+-nr" target="_blank">http://swat:8008/sort+-nr</a>" | \
&gt; curl --data-binary @- "<a href="http://swat:8009/gzip" target="_blank">http://swat:8009/gzip</a>" | \
&gt; gunzip
97
37
23
23
21
18
11
11
10
10</span></pre>
<p>In my position, we have a database with host information &#8211; which has a command line interface. This tool has dependencies which are a painful to resolve. With <a href="http://bashcurescancer.com/media/scripts/to_web.py.txt">to_web.py</a>, we can turn the command line tool into a web service and access the data without having to satisfy those additional dependencies.</p>
<p><em>This is guest post by my esteemed colleague <strong>Adam Fokken</strong>. He can be reached here: <img src="http://spamdefeator.com/u/1ea" alt="" />Sadly, he does not have a blog. </em></p>
]]></content:encoded>
			<wfw:commentRss>http://bashcurescancer.com/exposing-command-line-programs-as-web-services.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.198 seconds -->

