<?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>underdog-blog &#187; shell</title>
	<atom:link href="http://blog.underdog-projects.net/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.underdog-projects.net</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 23 Oct 2010 18:43:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>init script for the TIBCO Administrator</title>
		<link>http://blog.underdog-projects.net/2009/09/init-script-for-the-tibco-administrator/</link>
		<comments>http://blog.underdog-projects.net/2009/09/init-script-for-the-tibco-administrator/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 17:03:06 +0000</pubDate>
		<dc:creator>jens</dc:creator>
				<category><![CDATA[TIBCO]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[BusinessWorks]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.underdog-projects.net/?p=428</guid>
		<description><![CDATA[I recently ran into the situation that I needed to install a TIBCO BusinessWorks with Administrator onto a RedHat Server. Under Windows the installer provides everthing you need to run your domain as a Service. In Linux this looks different. I have found no init script templates nor did the installer generate me some stubs. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ran into the situation that I needed to install a TIBCO BusinessWorks with Administrator onto a RedHat Server. Under Windows the installer provides everthing you need to run your domain as a Service. In Linux this looks different. I have found no init script templates nor did the installer generate me some stubs. So I had to write them myself. So here is what I came up with (I know it isn&#8217;t perfect, but it works &#8211; suggestions are always welcome).</p>
<p><strong>for the Administrator:</strong></p>
<pre class='prettyprint lang-shell'>
#!/bin/bash

DOMAIN=tibcoesb
USER=esb
TIBCO_HOME=/home/$USER/tibco
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=tibco-admin

start() {
# Start daemons.
echo "Starting Tibco Admin"
/bin/su $USER -c"cd $TIBCO_HOME/administrator/domain/$DOMAIN/bin;./tibcoadmin_$DOMAIN 2>&#038;1 | /usr/bin/logger -t $NAME" &#038;
echo "done"
}

stop() {
# Stop daemons.
echo "Shutting down Tibco Admin"
killall tibcoadmin_$DOMAIN
echo "done"
}

case "$1" in
  start)
	start
	    ;;
  stop)
	stop
    	    ;;
  *)
        echo $"Usage: $0 {start|stop}"
    	exit 2
esac
</pre>
<p><strong>for the Hawk</strong></p>
<pre class='prettyprint lang-shell'>
#!/bin/bash

DOMAIN=tibcoesb
USER=esb
TIBCO_HOME=/home/$USER/tibco
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=tibco-hawk

start() {
# Start daemons.
echo "Starting Tibco Hawk"
/bin/su $USER -c"cd $TIBCO_HOME/tra/domain/$DOMAIN;./hawkagent_$DOMAIN 2>&#038;1 | /usr/bin/logger -t $NAME" &#038;
echo "done"
}

stop() {
# Stop daemons.
echo "Shutting down Tibco Hawk"
killall hawkagent_$DOMAIN
echo "done"
}

case "$1" in
  start)
	start
	    ;;
  stop)
	stop
    	    ;;
  *)
        echo $"Usage: $0 {start|stop}"
    	exit 2
esac
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.underdog-projects.net/2009/09/init-script-for-the-tibco-administrator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bringing the yahoo finance stream to the shell</title>
		<link>http://blog.underdog-projects.net/2009/02/bringing-the-yahoo-finance-stream-to-the-shell/</link>
		<comments>http://blog.underdog-projects.net/2009/02/bringing-the-yahoo-finance-stream-to-the-shell/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 14:17:06 +0000</pubDate>
		<dc:creator>jens</dc:creator>
				<category><![CDATA[yahoo finance]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[streaming api]]></category>

		<guid isPermaLink="false">http://blog.underdog-projects.net/?p=97</guid>
		<description><![CDATA[A little while ago a posted a primitive way to get to yahoo finance streaming data. As you can guess this was just the beginning. To raise the bar I tried to parse the received data and bring it to the shell. To get this done I needed several tools. curl &#8211; to send and [...]]]></description>
			<content:encoded><![CDATA[<p>A little while ago a posted a primitive way to get to yahoo finance streaming data. As you can guess this was just the beginning. To raise the bar I tried to parse the received data and bring it to the shell. To get this done I needed several tools.</p>
<ul>
<li>curl &#8211; to send and receive the http request</li>
</ul>
<ul>
<li><a href="http://blog.underdog-projects.net/2009/01/streaming-editor-improved/">transform</a> &#8211; a primitive tool to do streaming operations within one line</li>
</ul>
<ul>
<li>spidermonkey shell (a javascript shell which can parse and reformat the data)</li>
</ul>
<p>The complete logic will be done in the javascript. So lets start with the curl command line:</p>
<pre class="prettyprint lang-sh">curl -s -o - -N 'http://streamerapi.finance.yahoo.com/streamer/1.0?s=JAVA,MSFT&amp;k=l10&amp;callback=parent.yfs_u1f&amp;mktmcb=parent.yfs_mktmcb&amp;gencallback=parent.yfs_gencb'</pre>
<p>Let&#8217;s see what we have here. First we call the yahoo streaming api and want the current price (l10) for the stocks of Sun ans Microsoft. The callback part cannot be changed. If you change this part the whole request will not succeed. Also important is to get the output to STDOUT so that we can pipe the output to the next application.</p>
<p>Second part of the work is just to call the transform application (<a href="http://blog.underdog-projects.net/2009/01/streaming-editor-improved/">further explanation here</a>).</p>
<p>The third part is to pipe the output of the transform process into the javascript shell. I started the shell with the following command:</p>
<pre class="prettyprint lang-sh">js -f script.js</pre>
<p>The script script.js look like this:</p>
<pre class="prettyprint lang-js">yfs_u1f = function(tmp) {
try{
print("msft: "+tmp.MSFT.l10);
}catch(ex){}
try{
print("java: "+tmp.JAVA.l10);
}catch(ex){}
};

yfs_mktmcb = function(tmp) {
/*ignore timestamp */

};
var parent=this;
parent.yfs_u1f = yfs_u1f;
parent.yfs_mktmcb = yfs_mktmcb;

while(1==1){
var t = readline();
if(t.substr(0,3) == "try"){
eval(t);
}
}</pre>
<p>First we have to implement the callback functions which will be called from the http response. Then we construct an object called parent where we map these functions into. Now we have a working construct to receive the data and are able to work with it in our shell. What we need now is a little while loop to continuously read from STDIN and wait for new data. By the way accessing the tmp variable in the callback function seems somewhat complicated to me. I&#8217;m sure there is an easier way to access it but I have no clue how. If you have an idea how to do it better please post it to the comments.</p>
<p>The complete bash statement would look like this:</p>
<pre class="prettyprint lang-sh">curl -s -o - -N 'http://streamerapi.finance.yahoo.com/streamer/1.0?s=JAVA,MSFT&amp;k=l10&amp;callback=parent.yfs_u1f&amp;mktmcb=parent.yfs_mktmcb&amp;gencallback=parent.yfs_gencb' | /tmp/transform | js -f script.js</pre>
<p>If you run this you should get this output:</p>
<blockquote><p>msft: 17.83<br />
java: 4.47<br />
msft: 17.84<br />
msft: 17.86<br />
msft: 17.81<br />
java: 4.46</p></blockquote>
<p>Now you can use whatever tools you want to work with that data. For me this will be piped directly into my postgres db for further processing.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.underdog-projects.net/2009/02/bringing-the-yahoo-finance-stream-to-the-shell/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

