<?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>Gingerlime</title>
	<atom:link href="http://blog.gingerlime.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.gingerlime.com</link>
	<description></description>
	<lastBuildDate>Mon, 01 Mar 2010 18:37:33 +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>who&#8217;s calling?</title>
		<link>http://blog.gingerlime.com/whos-calling</link>
		<comments>http://blog.gingerlime.com/whos-calling#comments</comments>
		<pubDate>Sat, 27 Feb 2010 00:43:25 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/?p=100</guid>
		<description><![CDATA[Caller ID is a wonderful feature. Don&#8217;t we love getting a call from someone we like, and perhaps more importantly, ignore those annoying callers who we really don&#8217;t want to talk to.
But this is yesterday&#8217;s news. We all have caller IDs. It just works. Well, yes. It does. But what if we get a call [...]]]></description>
			<content:encoded><![CDATA[<p>Caller ID is a wonderful feature. Don&#8217;t we love getting a call from someone we like, and perhaps more importantly, ignore those annoying callers who we really don&#8217;t want to talk to.</p>
<p>But this is yesterday&#8217;s news. We all have caller IDs. It just works. Well, yes. It does. But what if we get a call on our landline? We get the caller ID there too, but do we know who it is?? All our contacts are on our mobile phones. Standard phones don&#8217;t usually have the capacity to hold more than 10 names on average.  And even if they did. Who&#8217;s got the energy to key in those numbers?</p>
<p>Enters Asterisk. Asterisk supports name as well as numbers for caller ID. But how do you get your asterisk to know the name of the caller? How can we inject the caller&#8217;s name into the caller ID string sent to our voip phones?</p>
<p>I&#8217;ve seen some online posts (like <a href="http://www.voiptechchat.com/voip/213/asterisk-script-caller-id-name-cnam-lookup/">this one</a>) about setting up look-up through online phone directories. I wanted something simpler. Why can&#8217;t I have my asterisk know who&#8217;s calling, based on my contacts on my iphone address book??</p>
<p>So here&#8217;s what I did. It can work on any address book format, as long as you can get it out as a csv (examples for iphone <a href="http://paulievox.wordpress.com/2008/11/01/how-to-backup-iphone-address-book-recover-from-a-mobile-me-sync-disaster/">here</a> and <a href="http://forums.anandtech.com/showthread.php?t=306101">here</a>). I created a simple CSV file, with two columns: Name and Number, which looks like this:</p>
<div class="codesnip-container" >&#8220;Tony Blair&#8221;,07392838482<br />
&#8220;Gordon Brown&#8221;,07893420393<br />
&#8220;Kate Moss&#8221;,07393837732<br />
&#8230;</div>
<p>I then created a little python script to run on my asterisk box, and pull the name based on the number. It&#8217;s an AGI script, but it&#8217;s so basic it doesn&#8217;t actually need any AGI libraries:</p>
<div class="codesnip-container" >
<div class="python codesnip" style="font-family:monospace;"><span class="co1">#!/usr/bin/env python</span></p>
<p><span class="kw1">import</span> <span class="kw3">sys</span><br />
<span class="kw1">import</span> <span class="kw3">csv</span></p>
<p><span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#41;</span> <span class="sy0">&lt;</span>= 1: &nbsp; &nbsp;<br />
&nbsp; &nbsp; exit<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <br />
cid = <span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&quot;-&quot;</span>,<span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&quot; &quot;</span>,<span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>.<span class="me1">strip</span><span class="br0">&#40;</span><span class="br0">&#41;</span></p>
<p><span class="co1"># accepting AGI input (but there&#8217;s nothing to do with it)</span><br />
<span class="kw1">while</span> 1:<br />
&nbsp; &nbsp; line = <span class="kw3">sys</span>.<span class="me1">stdin</span>.<span class="kw3">readline</span><span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="kw1">not</span> line:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> line==<span class="st0">&quot;<span class="es0">\n</span>&quot;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span></p>
<p>fd = <span class="kw2">file</span><span class="br0">&#40;</span><span class="st0">&quot;/usr/share/asterisk/agi-bin/my_iphone_address_book.csv&quot;</span><span class="br0">&#41;</span></p>
<p><span class="kw1">print</span> <span class="st0">&#8216;VERBOSE &quot;STATUS: Looking up %s&quot; 2&#8242;</span> <span class="sy0">%</span> cid<br />
<span class="kw1">for</span> line <span class="kw1">in</span> <span class="kw3">csv</span>.<span class="me1">reader</span><span class="br0">&#40;</span>fd<span class="br0">&#41;</span>:<br />
&nbsp; &nbsp; <span class="co1"># note: comparing the number back-to-front, and only comparing 8 rightmost digits.</span><br />
&nbsp; &nbsp; <span class="co1"># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This helps dealing with different prefix, e.g. +44, 00, 001 etc. and still getting </span><br />
&nbsp; &nbsp; <span class="co1"># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; an accurate match.</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> line<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&quot;-&quot;</span>,<span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&quot; &quot;</span>,<span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>.<span class="me1">strip</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#91;</span>::-1<span class="br0">&#93;</span><span class="br0">&#91;</span>:8<span class="br0">&#93;</span> == cid<span class="br0">&#91;</span>::-1<span class="br0">&#93;</span><span class="br0">&#91;</span>:8<span class="br0">&#93;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&#8216;VERBOSE &quot;STATUS: Found %s : %s&quot; 2&#8242;</span> <span class="sy0">%</span> <span class="br0">&#40;</span>cid, line<span class="br0">&#91;</span>0<span class="br0">&#93;</span>.<span class="me1">strip</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&#8216;SET VARIABLE CALLERID(name) &quot;%s&quot;&#8217;</span> <span class="sy0">%</span> line<span class="br0">&#91;</span>0<span class="br0">&#93;</span>.<span class="me1">strip</span><span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; exit<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
<span class="kw1">print</span> <span class="st0">&#8216;VERBOSE &quot;STATUS: %s Not Found&quot; 2&#8242;</span> <span class="sy0">%</span> cid</div>
</div>
<p>It can be invoked in the same way as described <a href="http://www.teamforrest.com/blog/89/using-agi-to-get-caller-id-name-cnam/">here</a>, i.e.:</p>
<div class="codesnip-container" >exten => s,n,Gosub(cidname-lookup,s,1)<br />
exten => s,n,dial(${PHONE},30,t)<br />
&#8230;<br />
[cidname-lookup]<br />
exten => s,1,NoOp(looking up callerid name)<br />
exten => s,n,GotoIf($["foo${CALLERID(NAME)}" = "foo" ]?getname)<br />
exten => s,n,GotoIf($["${CALLERID(NAME)}" = "${CALLERID(NUM)}" ]?getname)<br />
exten => s,n,NoOp(caller id name exists as ${CALLERID(NAME)})<br />
exten => s,n,Return<br />
exten => s,n(getname),AGI(calleridname.py,${CALLERID(NUM)})<br />
exten => s,n,NoOp(Caller ID Name is now ${CALLERID(NAME)})<br />
exten => s,n,Return</div>
<p><del datetime="2010-03-01T18:34:43+00:00">Note that it&#8217;s currently only working with full matches. The caller ID number must match the record on the address book precisely. Let me know if you have any simple ideas for partial matches (e.g. to avoid non matches of numbers, e.g. +447771110006 != 07771110006). I&#8217;ll do some more research when I get a chance.<br />
</del><br />
Update: code now deals with partial matches rather effectively.</p>
<p>Another benefit is with voicemails. I started forwarding my voicemail straight to my asterisk box. My mobile provider doesn&#8217;t support visual voicemail yet, and I find it frustrating to use the old fashioned voicemail system. Now when I get an email with the voicemail message, I not only see the number of the caller, and can call them back with a click. I also see their name.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/whos-calling/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get in shape</title>
		<link>http://blog.gingerlime.com/get-in-shape</link>
		<comments>http://blog.gingerlime.com/get-in-shape#comments</comments>
		<pubDate>Wed, 20 Jan 2010 20:56:00 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/?p=93</guid>
		<description><![CDATA[ISPs are a strange breed. They&#8217;re supposed to give a very straight-forward service &#8211; plug me in to the Internet please. That&#8217;s all. Plain and simple. It seems like some ISPs have different ideas as to their roles and responsibilities. Traffic shaping is one of those. Port/Service blocking is its ugly cousin. I don&#8217;t like [...]]]></description>
			<content:encoded><![CDATA[<p>ISPs are a strange breed. They&#8217;re supposed to give a very straight-forward service &#8211; plug me in to the Internet please. That&#8217;s all. Plain and simple. It seems like some ISPs have different ideas as to their roles and responsibilities. Traffic shaping is one of those. Port/Service blocking is its ugly cousin. I don&#8217;t like either. You&#8217;re not my Big Brother. If I wanted one I&#8217;d move to China.</p>
<p><span id="more-93"></span></p>
<p>ISPs enjoy a legal freedom of being considered a <em>mere conduit</em>. That means they&#8217;re not responsible for whatever their customers do with their connection. Nobody can sue the ISP for copyright infringement or any such or other illegal activity. And it makes sense. They&#8217;re just a pipe. If you, as a customer, choose to send poison down the pipe &#8211; it&#8217;s not the ISPs fault. That is, as long as they don&#8217;t control or take part in the communication.</p>
<p>Some ISPs want to have it both ways however. They&#8217;re not happy with some of the traffic, want to reduce their bandwidth and costs, and so they start using some traffic shaping measures. Their customers aren&#8217;t supposed to notice, and they are rarely being told about it either.</p>
<p>Whilst in Israel, I encountered a weird problem with <a href="http://www.012.net">012 Smile</a>, a local ISP. I must have spent hours on the phone to their support until the issues I was having were resolved. Some sites were painfully slow. Watching a youtube video or any video on the BBC, Guardian and many other websites, particularly out of Israel, was simply impossible. The other odd thing I came across was that one TCP port seemed to be blocked completely. One of my hosting providers use port 2095 for webmail. I simply couldn&#8217;t establish a connection. Testing it further, I noticed that the connection on port 2095 was established, but I was getting no response. As if there was some transparent proxy along the way. This whole thing reeked of traffic shaping, or worse, active blocking of services. Convincing the support staff it was an actual problem was no easy feat. I&#8217;m lucky I know enough to explain and insist when necessary, but for the average joe (or average Yossi in this case), 012 makes it next to impossible to get it sorted. Their support blamed it on the computer, on the router, on the cable provider. They blamed it on anything but themselves (oddly, they didn&#8217;t blame it on the boogie!).</p>
<p>So the problem got sorted out eventually. It was painful, but 012 made some magic changes and things got better. I insisted on getting a full explanation about the problem, but was given none. All they said was they fixed it. They claimed to made some routing changes, but no routing changes can affect access to a single port!! Pushing the support staff further, I was hinted about some traffic shaping that 012 are using.</p>
<p>How can you tell your ISP is using traffic shaping? Shouldn&#8217;t it be something they HAVE to tell you about? I think it should be. This is not something you see on their website, or even T&#038;Cs. I personally think legislation is the way forward here. And of course consumer pressure. Most consumers are sadly unaware of it.</p>
<p>I&#8217;m not sure if or how much traffic shaping is done in the UK. However, UK ISPs are reported to show concern about the new Digital Economy Bill. Particularly the need to monitor their own users and track repeat offenders. Without going into debate into the bill itself (for which there is plenty of criticism), those ISPs who use traffic shaping and blocking might find it hard to argue their case. If you do control traffic in some way, you&#8217;re no longer <em>mere conduit</em>, and you CAN be expected by the government to enforce other degrees of control (and responsibility/liability) over your users.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/get-in-shape/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Guilty Pleasures</title>
		<link>http://blog.gingerlime.com/guilty-pleasures</link>
		<comments>http://blog.gingerlime.com/guilty-pleasures#comments</comments>
		<pubDate>Wed, 25 Mar 2009 14:23:02 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/?p=62</guid>
		<description><![CDATA[Perhaps yet another misleading title for this post, but bear with me. When I was a child we used to play outside a lot. I always remember the neighbours complaining if we made too much noise. Such is life. There was one period of time that I knew I would get in trouble though. We [...]]]></description>
			<content:encoded><![CDATA[<p>Perhaps yet another misleading title for this post, but bear with me. When I was a child we used to play outside a lot. I always remember the neighbours complaining if we made too much noise. Such is life. There was one period of time that I knew I would get in trouble though. We would get told off big time!! When?? Every day between 2 and 4 in the afternoon. There was even a sign in big red letters telling us all to keep quiet at &#8216;rest time&#8217; (loosely translated). There was no sign about making noise after 11pm, but there was one for the afternoon nap. It was THAT important.<br />
<br/>These days seem long gone now. Does anybody have time for an afternoon nap?? I certainly don&#8217;t recall seeing any such signs around.<br />
<span id="more-62"></span><br />
I just LOVE an afternoon nap. It&#8217;s one of modern life&#8217;s guiltiest pleasures. You just know you have things to do, and you&#8217;re not supposed to just switch off, but you slip into bed, close the door, pull the blinds down, and even 30 minutes get you feeling like a whole new person. Oh the pure joy.</p>
<p><br/><br />
Alas, even with no kids playing around (do kids play outside anyway??), there is always an odd telephone call to wake you up and make you feel even worse (either from guilt or just for being woken up). This can also happen in the morning. Well, for some people it&#8217;s late morning or even early afternoon, but I do like to stay in bed late and have a good lie-in.</p>
<p>So what&#8217;s the problem?? I can easily unplug my phones. Well, it&#8217;s a no brainer with the mobile. The only time it&#8217;s switched off is when I&#8217;m asleep anyway. But the landline?? I don&#8217;t get many people to call me at home these days, but particularly if my mobile is switched off, people (my mum is the worst offender) will make an effort and check that I&#8217;m alive. I know I can unplug it, and on my fancy Asterisk box I can even set it to Do Not Disturb by simply calling *78. But I usually forget about it, or forget to plug it in again, and frankly it&#8217;s a hassle.</p>
<p><br/><br />
What I want to do is switch the ringing off as soon as I switch off my mobile phone. Have those two aware of each other somehow. How??</p>
<p>Well, this is not a solution for everybody, but it works for me. The idea was taken from <a href="http://nerdvittles.com/?p=185">Nerd Vittles</a> but modified for my needs and even improved it. No need to install bluetooth software on my Asterisk box. I already have it on my Ubuntu at home. Most bluetooth dongles are pretty much plug&#038;play these days with most Linux desktop distros.</p>
<p>Who is this solution for? or what do you need?</p>
<ul>
<li><a href="http://www.asterisk.org/">Asterisk</a> &#8211; the best open source VOIP system</li>
<li>ssh access to your asterisk (with ssh keys to avoid password prompts)</li>
<li>Voip Phone</li>
<li>bluetooth enabled on your home Linux box (mine is Ubuntu 8.04)</li>
<li><a href="http://blueproximity.sourceforge.net/index.html">Blueproximity</a></li>
<li>A bluetooth enabled mobile phone</li>
</ul>
<p>So what&#8217;s going on and how??</p>
<p>If you&#8217;re familiar with Asterisk, ssh and some basic scripting, you&#8217;ll have no problems following it. I&#8217;m not going to spell out each step, but feel free to ask if you need.</p>
<p>The idea is very simple. <a href="http://blueproximity.sourceforge.net/index.html">Blueproximity</a> is meant to be used to lock/unlock your PC when you&#8217;re close or far from it, based on signal from your bluetooth phone. It&#8217;s extensible enough to launch any script you choose, so I simply configured it so when I&#8217;m at home &#8211; my bluetooth phone is within a reasonable proximity &#8211; it launches a script to enable my home phone to ring. When I&#8217;m out of reach (mobile or bluetooth is off) &#8211; it automatically redirects calls to my home phone to my voicemail.</p>
<p><a href="http://nerdvittles.com/?p=185">Nerd Vittles</a>&#8217;s set-up was to forward calls to your mobile. You can do that too. However, the biggest downsides of this solution is that you need the bluetooth installed on your Asterisk server. Mine is hosted in Germany, so just a little too far to detect my mobile&#8217;s bluetooth signal.</p>
<p>My desktop however, is more than capable to cover the entire flat.</p>
<p>So I created a little script on my remote Asterisk box which changes the dialplan to either forward direct to voicemail, or to my home extension:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="co0">#!/bin/sh</span></p>
<p><span class="co0"># DND On &#8211; Do Not Disturb</span></p>
<p>asterisk <span class="re5">-rx</span> <span class="st0">&quot;dialplan add extension 1234,1,Voicemail(u1234@default) into inbound replace&quot;</span></div>
</div>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="co0">#!/bin/sh</span></p>
<p><span class="co0"># DND Off &#8211; Ring my phone</span></p>
<p>asterisk <span class="re5">-rx</span> <span class="st0">&quot;dialplan add extension 1234,1,Dial(SIP/1234,20,trj) into inbound replace&quot;</span></div>
</div>
<p>I then created two matching scripts on my home desktop which simply call those scripts remotely:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="co0">#!/bin/sh</span></p>
<p><span class="kw2">ssh</span> my.asterisk.box <span class="st0">&quot;dnd-on&quot;</span></div>
</div>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="co0">#!/bin/sh</span></p>
<p><span class="kw2">ssh</span> my.asterisk.box <span class="st0">&quot;dnd-off&quot;</span></div>
</div>
<p>I obviously use <a href="http://pkeck.myweb.uga.edu/ssh/">ssh keys</a> to authenticate to my asterisk box without a password.</p>
<p>Now all is left is to set up Blueproximity to launch those scripts instead of the default gnome-screensaver-command</p>
<p>I set the lock proximity in Blueproximity to the max and the unlock to slightly lower.<br />
<br/>All I have to do to have some quiet time and enjoy my guilty pleasure is simply switch off my mobile.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/guilty-pleasures/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GoDaddy taking european domains hostage prior to expiration</title>
		<link>http://blog.gingerlime.com/godaddy-taking-european-domains-hostage-prior-to-expiration</link>
		<comments>http://blog.gingerlime.com/godaddy-taking-european-domains-hostage-prior-to-expiration#comments</comments>
		<pubDate>Mon, 23 Feb 2009 02:17:50 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/?p=52</guid>
		<description><![CDATA[This is something I never thought would concern me. All those domain ownership issues, I thought, were with people who just aren&#8217;t organised enough to renew their domains, forget their passwords, or pick domains that others try to steal.
I&#8217;m currently managing a couple of .DE and one .CO.UK domains on Godaddy. The .co.uk domain was [...]]]></description>
			<content:encoded><![CDATA[<p>This is something I never thought would concern me. All those domain ownership issues, I thought, were with people who just aren&#8217;t organised enough to renew their domains, forget their passwords, or pick domains that others try to steal.</p>
<p>I&#8217;m currently managing a couple of .DE and one .CO.UK domains on Godaddy. The .co.uk domain was bought for a fairly long period, so no problems there, but recently, both the .de domains were up for renewal. I received a couple of email reminders from GoDaddy, but when I logged into my account I noticed they are only due to expire on 26th March. More than a month away. On the last email I received on the 20th, I decided it&#8217;s probably time to renew, so clicked on the link and was getting my credit card ready.</p>
<p>To my surprise, the GoDaddy domain portal did not allow me to renew them, and marked them as &#8216;pending expiration&#8217;. hmmm&#8230; weird. Oh well, I emailed GoDaddy and asked to renew, not even worrying too much. Maybe a system glitch of some sort.<br />
<span id="more-52"></span></p>
<p>When an email arrived in response, it said that all .co.uk (yeah, this is not a typo, even though I emailed them about 2 .de domains) have to be renewed on the 20th of the month prior to expiration. Very strange. I pointed out to GoDaddy that these were .de domains and even so, why can&#8217;t they allow you to renew over their own website??</p>
<p>It was then, that things were beginning to look suspicious. I tried to access both those domains, and was shocked to find out I&#8217;m being redirected to a GoDaddy &#8216;free parking&#8217; page &#8211; i.e. a page full of GoDaddy ads and links. Not to where it should have led me to obviously.</p>
<p>WHAT?? The domains are still mine. They have not expired, yet GoDaddy simply hijacked them. That can&#8217;t be right. Surely enough. That&#8217;s what GoDaddy did.</p>
<p>Ok. I felt angry, and disappointed and very stupid too. Did I miss an email reminder telling me this is going to happen and I ignored it?? I searched through my emails, and nowhere did it say anything about it. </p>
<p>This is what their initial renewal email said</p>
<div class="codesnip-container" >You have elected that the domain name(s) above renew manually. This means that they WILL EXPIRE if you do not log in to your account and renew them by the expiration date(s) listed.</div>
<p>BY THE EXPIRATION DATE(s) LISTED. The dates listed were 26th March. Not the 20th of February.</p>
<p>Ok, so maybe it&#8217;s on the original Terms and Conditions I must have signed. I searched, and looked, and searched again. Nothing.</p>
<p>Right then, so it&#8217;s probably something the .DE domain TLD forces GoDaddy to do. I trawled through <a href="http://www.denic.de">DENIC</a>. Trying to find a clue. Nope. Nein. Nicht. </p>
<p>I&#8217;ve had numerous emails and a long telephone conversation with GoDaddy support, but they simply wouldn&#8217;t listen. I eventually got to a supervisor who gave me two options:</p>
<p>1. Do nothing, and these domains will expire, but only on the 26th March. Until then they are not going to be released or re-activated.<br />
2. Pay their renewal fees, agree to their terms (which also mean 60 days lock from transferring)</p>
<p>I obviously had no alternative but to pay. The fees were reasonable. At least no nasty &#8216;re-activation fee&#8217;. I didn&#8217;t mind paying the renewal fees anyway and in the first place. But why hijack my domains??</p>
<p>As of now, nearly 24 hours after paying, and after another couple of emails to their support, my domains are still locked and redirected to a landing page.</p>
<p>I then came across <a href="http://princesimon.wordpress.com/2008/12/30/godaddycoms-shady-and-unethical-domain-names-renewal-process/">this post</a> by <a href="http://princesimon.wordpress.com/about/">Simon Kapenda</a>. Looks like he&#8217;s in a similar position to mine. There was another similar post, mostly with .co.uk domains <a href="http://codingforums.com/showthread.php?t=117457">here</a>, but not much more I could find.</p>
<p>If you&#8217;ve been affected please let me know. Surely there&#8217;s something that can be done to complain against such practice.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/godaddy-taking-european-domains-hostage-prior-to-expiration/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Postcode, Barcode and python code</title>
		<link>http://blog.gingerlime.com/postcode-barcode-and-python-code</link>
		<comments>http://blog.gingerlime.com/postcode-barcode-and-python-code#comments</comments>
		<pubDate>Fri, 30 Jan 2009 15:22:14 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/?p=41</guid>
		<description><![CDATA[I&#8217;ve had a strange thing happening a while ago. I sent a CD in a padded envelope to someone, and it was returned to me. Well, it didn&#8217;t look like it was returned, more like they actually delivered it to me instead of to the person I sent it to.
Then I noticed something. I was [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a strange thing happening a while ago. I sent a CD in a padded envelope to someone, and it was returned to me. Well, it didn&#8217;t look like it was returned, more like they actually delivered it to me instead of to the person I sent it to.</p>
<p>Then I noticed something. I was re-using an old envelope. For environmental reasons of course (read: being so tight-assed, saving money on padded envelopes). I did write the destination address on the right side, so my address was nowhere on the envelope. What was left there however was this tiny printed barcode used by the previous sender with my address.<br />
<span id="more-41"></span><br />
So it occurred to me, the postoffice didn&#8217;t even bother reading the address I put there, it scanned the little barcode instead. </p>
<p>Neat. So maybe I could print those barcodes and make sure my letters get to the right destination.</p>
<p>A little googling brought me to this nice <a href="http://www.bluetang.co.uk/btwebsystems/utilities/postbarcode/Default.aspx">web page</a> you can put your postcode and it generates a string for you, which if you use in a word processor with a special barcode font (also available for <a href="http://www.bluetang.co.uk/btwebsystems/utilities/postbarcode/Custcode.ttf">download</a> there), you can print out yourself. </p>
<p>That&#8217;s nice. What I couldn&#8217;t work out however, is how the postcode checksum is calculated. The <a href="http://www.bluetang.co.uk/btwebsystems/utilities/postbarcode/Default.aspx">website</a> was nice enough to do it for you, but what happens if it&#8217;s unavailable or goes down??</p>
<p>My good friend Dan, after noticing I used those fancy barcodes on a letter I sent him, managed to find more information about the <a href="http://www.mailsorttechnical.com/docs/mug_2008/MUG_2008_08_Mailsort_700.pdf">checksum algorithm</a>, and was even kind enough to write some perl code that runs it. </p>
<p>When Dan shares his code I&#8217;ll link to it, but meanwhile, and just to practice with some python coding, I wrote my own python code to do the same thing (but obviously in a much nicer way than perl):</p>
<div class="codesnip-container" >
<div class="python codesnip" style="font-family:monospace;"><span class="co1">#!/usr/bin/env python</span></p>
<p><span class="kw1">import</span> <span class="kw3">sys</span><br />
<span class="kw1">import</span> <span class="kw3">re</span></p>
<p><span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#41;</span><span class="sy0">&lt;</span>2:<br />
&nbsp; <span class="kw1">print</span> <span class="st0">&quot;&quot;&quot;<br />
&nbsp; &nbsp; Usage: Postcode.py &lt;PostCode&gt; [&lt;Suffix&gt;]<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &lt;PostCode&gt; must appear with no spaces, e.g. SN34RD, case insensitive<br />
&nbsp; &nbsp; &lt;Suffix&gt; is optional and set by default to 9Z (if you don&#8217;t know it, don&#8217;t use it)<br />
&nbsp; &quot;&quot;&quot;</span><br />
&nbsp; <span class="kw3">sys</span>.<span class="me1">exit</span><span class="br0">&#40;</span><span class="br0">&#41;</span></p>
<p>Suffix = <span class="st0">&#8216;9Z&#8217;</span><br />
<span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#41;</span><span class="sy0">&gt;</span>2:<br />
&nbsp; Suffix = <span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span>2<span class="br0">&#93;</span>.<span class="me1">upper</span><span class="br0">&#40;</span><span class="br0">&#41;</span></p>
<p><span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span>Suffix<span class="br0">&#41;</span><span class="sy0">!</span>=2:<br />
&nbsp; <span class="kw1">print</span> <span class="st0">&quot;&quot;&quot;<br />
&nbsp; Suffix or postcode incorrect. <br />
&nbsp; &nbsp;Please use postcodes without spaces or enclosed in &quot;&quot;<br />
&nbsp; &nbsp;Suffix must be 2 characters (or blank to use 9Z) <br />
&nbsp; &quot;&quot;&quot;</span><br />
&nbsp; <span class="kw3">sys</span>.<span class="me1">exit</span><span class="br0">&#40;</span><span class="br0">&#41;</span></p>
<p><span class="co1"># Check for correctness of postcode. Regular expression found at http://regexlib.com/REDetails.aspx?regexp_id=260</span><br />
<span class="co1"># (notice &#8211; not at top of the page, but on one of the bottom comments) &nbsp;</span><br />
<span class="kw1">if</span> <span class="kw1">not</span> <span class="kw3">re</span>.<span class="me1">match</span><span class="br0">&#40;</span><span class="st0">&quot;^(([A-PR-UWYZ]{1,2}[0-9]{1,2}[ABEHJMNPRVWXY]?)<span class="es0">\s</span>?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)<span class="es0">\s</span>?(0AA))$&quot;</span>, <span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span>1<span class="br0">&#93;</span>.<span class="me1">upper</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>:<br />
&nbsp; <span class="kw1">print</span> <span class="st0">&quot;Postcode incorrect. Please use correct UK postcodes and either without spaces or enclosed in <span class="es0">\&quot;</span><span class="es0">\&quot;</span>&quot;</span><br />
&nbsp; <span class="kw3">sys</span>.<span class="me1">exit</span><span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <br />
Postcode = <span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">upper</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&#8216; &#8216;</span>,<span class="st0">&#8221;</span><span class="br0">&#41;</span> + Suffix</p>
<p><span class="co1"># Matrix as it appears on the PDF guide. Note arrays are referenced from 0..5</span><br />
PostCodeMatrix = <span class="br0">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="st0">&#8216;0&#8242;</span>,<span class="st0">&#8216;1&#8242;</span>,<span class="st0">&#8216;2&#8242;</span>,<span class="st0">&#8216;3&#8242;</span>,<span class="st0">&#8216;4&#8242;</span>,<span class="st0">&#8216;5&#8242;</span><span class="br0">&#93;</span>, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="st0">&#8216;6&#8242;</span>,<span class="st0">&#8216;7&#8242;</span>,<span class="st0">&#8216;8&#8242;</span>,<span class="st0">&#8216;9&#8242;</span>,<span class="st0">&#8216;A&#8217;</span>,<span class="st0">&#8216;B&#8217;</span><span class="br0">&#93;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="st0">&#8216;C&#8217;</span>,<span class="st0">&#8216;D&#8217;</span>,<span class="st0">&#8216;E&#8217;</span>,<span class="st0">&#8216;F&#8217;</span>,<span class="st0">&#8216;G&#8217;</span>,<span class="st0">&#8216;H&#8217;</span><span class="br0">&#93;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="st0">&#8216;I&#8217;</span>,<span class="st0">&#8216;J&#8217;</span>,<span class="st0">&#8216;K&#8217;</span>,<span class="st0">&#8216;L&#8217;</span>,<span class="st0">&#8216;M&#8217;</span>,<span class="st0">&#8216;N&#8217;</span><span class="br0">&#93;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="st0">&#8216;O&#8217;</span>,<span class="st0">&#8216;P&#8217;</span>,<span class="st0">&#8216;Q&#8217;</span>,<span class="st0">&#8216;R&#8217;</span>,<span class="st0">&#8216;S&#8217;</span>,<span class="st0">&#8216;T&#8217;</span><span class="br0">&#93;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="st0">&#8216;U&#8217;</span>,<span class="st0">&#8216;V&#8217;</span>,<span class="st0">&#8216;W&#8217;</span>,<span class="st0">&#8216;X&#8217;</span>,<span class="st0">&#8216;Y&#8217;</span>,<span class="st0">&#8216;Z&#8217;</span><span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#93;</span></p>
<p><span class="co1"># A &#8216;reverse-lookup&#8217; dictionary for each postcode character</span><br />
PostCodeDict = <span class="br0">&#123;</span><span class="br0">&#125;</span><br />
<span class="kw1">for</span> row <span class="kw1">in</span> <span class="kw2">range</span> <span class="br0">&#40;</span>0,6<span class="br0">&#41;</span>: &nbsp;<br />
&nbsp; <span class="kw1">for</span> col <span class="kw1">in</span> <span class="kw2">range</span> <span class="br0">&#40;</span>0,6<span class="br0">&#41;</span>: &nbsp; &nbsp;<br />
&nbsp; &nbsp; PostCodeDict<span class="br0">&#91;</span><span class="br0">&#40;</span>PostCodeMatrix<span class="br0">&#91;</span>row<span class="br0">&#93;</span><span class="br0">&#91;</span>col<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#93;</span> = <span class="br0">&#40;</span><span class="br0">&#40;</span>row+1<span class="br0">&#41;</span><span class="sy0">%</span>6,<span class="br0">&#40;</span>col+1<span class="br0">&#41;</span><span class="sy0">%</span>6<span class="br0">&#41;</span></p>
<p><span class="br0">&#40;</span>rowSum, colSum<span class="br0">&#41;</span> = <span class="br0">&#40;</span>0,0<span class="br0">&#41;</span><br />
<span class="kw1">for</span> i <span class="kw1">in</span> Postcode:<br />
&nbsp; rowSum += PostCodeDict<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><br />
&nbsp; colSum += PostCodeDict<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span>1<span class="br0">&#93;</span> &nbsp;</p>
<p>Postcode += PostCodeMatrix<span class="br0">&#91;</span><span class="br0">&#40;</span>rowSum<span class="sy0">%</span>6<span class="br0">&#41;</span>-1<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="br0">&#40;</span>colSum<span class="sy0">%</span>6<span class="br0">&#41;</span>-1<span class="br0">&#93;</span><br />
<span class="kw1">print</span> <span class="st0">&quot;(%s)&quot;</span> <span class="sy0">%</span> Postcode</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/postcode-barcode-and-python-code/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sniffing some fresh tomatoes</title>
		<link>http://blog.gingerlime.com/sniffing-some-fresh-tomatoes</link>
		<comments>http://blog.gingerlime.com/sniffing-some-fresh-tomatoes#comments</comments>
		<pubDate>Wed, 03 Sep 2008 21:31:23 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/?p=28</guid>
		<description><![CDATA[Perhaps the title is a little misleading, but it&#8217;s an opportunity to combine two of my greatest loves: food and computers. I suppose even this intro is misleading. Oh. Forget it. Lets get down to business. And this time our business is rather short (and sweet).
Running tcpdump on my Linksys router (well, Buffalo WHR-54GS to [...]]]></description>
			<content:encoded><![CDATA[<p>Perhaps the title is a little misleading, but it&#8217;s an opportunity to combine two of my greatest loves: food and computers. I suppose even this intro is misleading. Oh. Forget it. Lets get down to business. And this time our business is rather short (and sweet).</p>
<p>Running tcpdump on my Linksys router (well, Buffalo WHR-54GS to be precise, but the same famous <a href="http://en.wikipedia.org/wiki/Linksys_WRT54G_series">WRT54G</a> clone that runs open source <a href="http://en.wikipedia.org/wiki/Linksys_WRT54G_series#Third-party_firmware_projects">firmware</a>). </p>
<p><span id="more-28"></span><br />
I&#8217;ve been running <a href="http://www.polarcloud.com/tomato">Tomato</a> firmware for quite a while now (from version 0.7 or something??). What a wonderful firmware. Definitely the very best. Neat. Stylish. Full of all the features one can think of. And then some. A true work of art.</p>
<p>Alas, I wanted to sniff some traffic to analyse using Wireshark (some SIP stuff, I might cover it some other time), and couldn&#8217;t be bothered getting my old heavy dusty hub out just to capture some packets. I was therefore turning to my fresh Tomato, but no such tool is available. </p>
<p>Well, not quite. </p>
<p>A few google searches concluded that I could probably get a pre-compiled binary, place it on a CIFS network share, and run it. So I did.</p>
<p>I download the latest ipkg of tcpdump off <a href="http://ipkg.nslu2-linux.org/feeds/unslung/wl500g/">ipkg.nslu2-linux.org</a>. Renamed the file to .tar.gz, untar&#8217;d it and extracted the binary inside data.tar.gz (/opt/bin/tcpdump).</p>
<p>I used a CIFS windows share feature on tomato. Straight under Administration->CIFS Client and pointed it to the share with the tcpdump binary. Telnet onto the router and off you go, saving the packet dump onto the same windows share. Then analyse it with Wireshark. Job Done. Smells delicious, doesn&#8217;t it?</p>
<div class="codesnip-container" ># telnet 192.168.0.1<br />
Trying 192.168.0.1&#8230;<br />
Connected to 192.168.0.1.<br />
Escape character is &#8216;^]&#8217;.<br />
unknown login: root<br />
Password: </p>
<p>Tomato v1.21.1515</p>
<p>BusyBox v1.2.2 (2008.07.26-14:43+0000) Built-in shell (ash)<br />
Enter &#8216;help&#8217; for a list of built-in commands.</p>
<p># cd /cifs1<br />
# ./tcpdump ip host 192.168.0.110 -w ./dumpfile.txt -s0<br />
tcpdump: listening on br0, link-type EN10MB (Ethernet), capture size 65535 bytes</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/sniffing-some-fresh-tomatoes/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>cron woes &#8211; file timsetamp monitoring plugin for munin</title>
		<link>http://blog.gingerlime.com/cron-woes-file-timsetamp-monitoring-plugin-for-munin</link>
		<comments>http://blog.gingerlime.com/cron-woes-file-timsetamp-monitoring-plugin-for-munin#comments</comments>
		<pubDate>Wed, 02 Jul 2008 13:53:06 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/?p=27</guid>
		<description><![CDATA[I don&#8217;t like being late. It runs in the family. My dad is so obsessed with being late that he&#8217;s always early. How embarrassing. Unfortunately I seemed to have inherited it from him. I do however try to compensate. I am deliberately late on-time. I usually plan to be a bit late. 
Anyway, enough about [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t like being late. It runs in the family. My dad is so obsessed with being late that he&#8217;s always early. How embarrassing. Unfortunately I seemed to have inherited it from him. I do however try to compensate. I am deliberately late on-time. I usually <strong>plan</strong> to be a bit late. </p>
<p>Anyway, enough about me.<br />
<span id="more-27"></span></p>
<p>cron cron cron, the mighty scheduler. Making sure things are running on time, but does it? Well, sort of. My cron (or more precisely anacron) has failed me. It appears like a logrotate cron.daily job was stuck due to some random bug in the lighttpd postrotate script (see <a href="http://lists.alioth.debian.org/pipermail/pkg-lighttpd-maintainers/2007-April/000543.html">here</a>). Causing anacron to lock, giving messages like:</p>
<div class="codesnip-container" >Job `cron.weekly&#8217; locked by another anacron &#8211; skipping</div>
<p>I don&#8217;t get it why if one script in the /etc/cron.* directory fails, or hangs, anacron doesn&#8217;t somehow detect it and moves on. I tried searching a bit, but couldn&#8217;t find anything. Any ideas or suggestions are welcome.</p>
<p>I then decided to be a little more careful, and monitor those cron jobs myself. The most important jobs are those running rsnapshot to run regular backups. I was looking for a simple way to check a file/folder modified timestamp and alert me if it reaches certain threshold, i.e. it&#8217;s older than X days.</p>
<p>I am already using <a href="http://munin.projects.linpro.no/">munin,</a> for monitoring cpu, network, diskspace etc and it has a CRITICAL/WARNING email notification built-in, so I thought it might be a good tool to use for this purpose too. The graphs aren&#8217;t going to be particularly useful, but the alerting functionality is. </p>
<p>It&#8217;s my first munin plugin, and one of a few python scripts I&#8217;ve written, so hope you can be forgiving for lack of style or technique</p>
<div class="codesnip-container" >
<div class="python codesnip" style="font-family:monospace;"><span class="co1">#!/usr/bin/env python</span></p>
<p><span class="kw1">import</span> <span class="kw3">os</span><br />
<span class="kw1">import</span> <span class="kw3">time</span><br />
<span class="kw1">import</span> <span class="kw3">datetime</span><br />
<span class="kw1">import</span> <span class="kw3">sys</span></p>
<p>
<span class="co1"># a python dictionary of file/folders and the threshold to issue a warning for each</span><br />
<span class="co1"># you can add a cron job to &#8216;touch&#8217; a file and check it, or use any file you expect to be up-to-date</span><br />
<span class="co1"># this list covers only the rsnapshot backups. You can see the different threshold for each folder based on the expected update frequency. 1 day for daily, 7 days for weekly, 31 for monthly</span></p>
<p>fileList = <span class="br0">&#123;</span><span class="st0">&quot;/var/cache/rsnapshot/daily.0&quot;</span>:<span class="nu0">1</span>, <span class="st0">&quot;/var/cache/rsnapshot/weekly.0&quot;</span>:<span class="nu0">7</span>, <span class="st0">&quot;/var/cache/rsnapshot/monthly.0&quot;</span>:31<span class="br0">&#125;</span></p>
<p>
<span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#41;</span> == 2 <span class="kw1">and</span> <span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> == <span class="st0">&quot;autoconf&quot;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&quot;yes&quot;</span><br />
<span class="kw1">elif</span> <span class="kw2">len</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#41;</span> == 2 <span class="kw1">and</span> <span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> == <span class="st0">&quot;config&quot;</span>:<br />
&nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&#8216;graph_title File Modified Date&#8217;</span><br />
&nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&#8216;graph_vlabel Days Since Modified&#8217;</span><br />
&nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&#8216;graph_category disk&#8217;</span><br />
&nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&#8216;graph_scale no&#8217;</span><br />
&nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&#8216;graph_info Monitors file/folder last modified date and shows how many days since modified. Also supports a warning if a specified number of days exceeds the threshold and a critical warning if file/folder does not exist&#8217;</span></p>
<p>&nbsp; &nbsp; <span class="kw1">for</span> item <span class="kw1">in</span> fileList:<br />
&nbsp; &nbsp; &nbsp; &nbsp;muninItem = item.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&quot;.&quot;</span>,<span class="st0">&quot;_&quot;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;muninItem2 = muninItem.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&quot;/&quot;</span>,<span class="st0">&quot;_&quot;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">print</span> <span class="st0">&#8216;%s.label %s&#8217;</span> <span class="sy0">%</span> <span class="br0">&#40;</span>muninItem2, muninItem<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">print</span> <span class="st0">&#8216;%s.warning %s&#8217;</span> <span class="sy0">%</span> <span class="br0">&#40;</span>muninItem2, fileList<span class="br0">&#91;</span>item<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">print</span> <span class="st0">&#8216;%s.critical 99998&#8242;</span> <span class="sy0">%</span> <span class="br0">&#40;</span>muninItem2<span class="br0">&#41;</span><br />
<span class="kw1">else</span>:</p>
<p>&nbsp; &nbsp; <span class="kw1">for</span> item <span class="kw1">in</span> fileList:<br />
&nbsp; &nbsp; &nbsp; &nbsp;muninItem = item.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&quot;.&quot;</span>,<span class="st0">&quot;_&quot;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;muninItem2 = muninItem.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&quot;/&quot;</span>,<span class="st0">&quot;_&quot;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">try</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; itemTime = <span class="kw3">time</span>.<span class="me1">localtime</span><span class="br0">&#40;</span><span class="kw3">os</span>.<span class="me1">path</span>.<span class="me1">getmtime</span><span class="br0">&#40;</span>item<span class="br0">&#41;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; itemDTime = <span class="kw3">datetime</span>.<span class="kw3">datetime</span><span class="br0">&#40;</span><span class="sy0">*</span>itemTime<span class="br0">&#91;</span>0:5<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; now = <span class="kw3">time</span>.<span class="me1">localtime</span><span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nowDTime = <span class="kw3">datetime</span>.<span class="kw3">datetime</span><span class="br0">&#40;</span><span class="sy0">*</span>now<span class="br0">&#91;</span>0:5<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&quot;%s.value %s&quot;</span> <span class="sy0">%</span> <span class="br0">&#40;</span>muninItem2, <span class="br0">&#40;</span>nowDTime &#8211; itemDTime<span class="br0">&#41;</span>.<span class="me1">days</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">except</span> <span class="kw2">OSError</span>:<br />
<span class="co1"># &nbsp; &nbsp; &nbsp; &nbsp;if the file doesn&#8217;t exist it returns 99999 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&quot;%s.value 99999&quot;</span> <span class="sy0">%</span> <span class="br0">&#40;</span>muninItem2<span class="br0">&#41;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/cron-woes-file-timsetamp-monitoring-plugin-for-munin/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JDK 5 Debian etch Virtuozzo installation oddities</title>
		<link>http://blog.gingerlime.com/jdk-installation-oddities</link>
		<comments>http://blog.gingerlime.com/jdk-installation-oddities#comments</comments>
		<pubDate>Thu, 03 Apr 2008 18:42:48 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/jdk-installation-oddities</guid>
		<description><![CDATA[Not a particularly interesting post, unless you happen to be running Debian 4.0 etch running on Virtuozzo host and are trying to install JDK5. I saw a post with a user reporting the same error on the parallels forum , but couldn&#8217;t find a clear solution, until I bumped onto a weird forum in German, [...]]]></description>
			<content:encoded><![CDATA[<p>Not a particularly interesting post, unless you happen to be running Debian 4.0 etch running on Virtuozzo host and are trying to install JDK5. I saw a post with a user reporting the same error on the <a href="http://forum.swsoft.com/showthread.php?t=50509">parallels forum</a> , but couldn&#8217;t find a clear solution, until I bumped onto a weird forum in German, which luckily linked to a related <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=402067">bug report</a> (in English).<br />
<span id="more-26"></span></p>
<p>So if you get this error message when installing jdk5:</p>
<div class="codesnip-container" >Setting up sun-java5-bin (1.5.0-14-1etch1) &#8230;<br />
Could not create the Java virtual machine.<br />
dpkg: error processing sun-java5-bin (&#8211;configure):<br />
 subprocess post-installation script returned error exit status 1<br />
Errors were encountered while processing:<br />
 sun-java5-bin<br />
E: Sub-process /usr/bin/dpkg returned an error code (1)</div>
<p>The solution is to edit the postinst script</p>
<div class="codesnip-container" ># vi /var/lib/dpkg/info/sun-java5-bin.postinst</div>
<p>comment out one line below:</p>
<div class="codesnip-container" ># activate class data sharing<br />
    case i386 in i386|sparc)<br />
        rm -f $basedir/jre/lib/i386/client/classes.jsa<br />
        ### $basedir/bin/java -client -Xshare:dump > /dev/null<br />
    esac</div>
<p>Then reinstall. Ugly, but it seems to do the trick</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/jdk-installation-oddities/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nico on jcom radio</title>
		<link>http://blog.gingerlime.com/nico-on-jcom-radio</link>
		<comments>http://blog.gingerlime.com/nico-on-jcom-radio#comments</comments>
		<pubDate>Mon, 05 Nov 2007 14:13:39 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/nico-on-jcom-radio</guid>
		<description><![CDATA[Download the file here
]]></description>
			<content:encoded><![CDATA[<p>Download the file <a href="http://www.gingerlime.com/Nico.mp3">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/nico-on-jcom-radio/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://www.gingerlime.com/Nico.mp3" length="18320000" type="audio/mpeg" />
		</item>
		<item>
		<title>Turbogears, Lighttpd and WSGI for real dummies</title>
		<link>http://blog.gingerlime.com/turbogears-lighttpd-and-wsgi-for-real-dummies</link>
		<comments>http://blog.gingerlime.com/turbogears-lighttpd-and-wsgi-for-real-dummies#comments</comments>
		<pubDate>Fri, 14 Sep 2007 19:49:39 +0000</pubDate>
		<dc:creator>Yoav Aner</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.gingerlime.com/turbogears-lighttpd-and-wsgi-for-real-dummies</guid>
		<description><![CDATA[Just so to set the records straight, I&#8217;m the real dummy here, as you would obviously see. 
I absolutely have no experience with python, lighttpd, turbogears or wsgi, fcgi but I was given a task to set it up on a server. All I used was some online posts and common sense. Normally I wouldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Just so to set the records straight, I&#8217;m the real dummy here, as you would obviously see. </p>
<p>I absolutely have no experience with python, lighttpd, turbogears or wsgi, fcgi but I was given a task to set it up on a server. All I used was some online posts and common sense. Normally I wouldn&#8217;t have to post a blog entry about it, most of the stuff is already out there. On this occasion however, I felt there&#8217;s some missing documentation, or else &#8211; simply because I don&#8217;t know anything about any of these it was more tricky than it usually is. Perhaps it&#8217;s one indicator how this all seems from the sysadmin perspective, as opposed to a turbogears developer.<br />
<span id="more-24"></span><br />
I&#8217;m not going to cover every step, because I feel the basics should be easy enough to follow if you&#8217;ve done some linux server setup. Documentation is pretty clear on the basic install stuff. Nevertheless, some things aren&#8217;t too clear, and I hope to cover at least to some extent. For example, I wasn&#8217;t quite sure whether I should rely on the debian packages or the python easy_setup ones, that can be retrieved automagically. I guess easy_setup is a good bet for the latest versions, as I&#8217;m using Debian 4 stable (etch), and try to avoid mixing stable and unstable, test &#8211; mostly because I&#8217;m not confident enough about not screwing things up</p>
<p>Ok, down to business then<br />
I&#8217;m running: </p>
<ul>Debian stable (Etch)<br />
python 2.4<br />
python setup tools (debian package)<br />
Turbogears 1.0.1 (debian package)<br />
Lighttpd (debian package)<br />
flup and scgi installed via easy_setup</ul>
<p>First thing I wasn&#8217;t sure about, is where to place the turbogears apps. I then decided to create /var/turbogears and put them under there. I don&#8217;t think it makes a huge difference, but seemed sensible enough.</p>
<p>I then created a turbogears app using </p>
<div class="codesnip-container" >
<div class="dos codesnip" style="font-family:monospace;">/var/turbogears# tg-admin quickstart<br />
Enter project name: newproject<br />
Enter package name <span class="br0">&#91;</span>newproject<span class="br0">&#93;</span>:<br />
<a href="http://www.ss64.com/nt/do.html"><span class="kw1">Do</span></a> you need Identity <span class="br0">&#40;</span>usernames/passwords<span class="br0">&#41;</span> <a href="http://www.ss64.com/nt/in.html"><span class="kw1">in</span></a> this project? <span class="br0">&#91;</span>no<span class="br0">&#93;</span><br />
&#8230;</div>
</div>
<p>so now there&#8217;s a new project called newproject under /var/turbogears/newproject.<br />
<br />
I then tried to follow <a href="http://cleverdevil.org/computing/34/deploying-turbogears-with-lighttpd-and-scgi">this link</a> (or <a href="http://docs.turbogears.org/1.0/LightTPD">this one</a> &#8211; which is essentially a mirror), to have it all served by lighty and wsgi, but then started having problems&#8230; Well &#8211; it simply wouldn&#8217;t work<br />
<br />
I wasn&#8217;t very surprised considering all I did was a copy&#038;paste job, without really understanding what&#8217;s going on. Getting to the root cause was somehow more of a challenge.</p>
<p>I wish I noted all the tiny different things I tried, but I&#8217;ll try to describe a couple of ones that helped along the way:<br />
<br />
enabling more detailed debugging in lighttpd.conf:</p>
<div class="codesnip-container" >debug.log-request-handling = &#8220;enable&#8221;<br />
scgi.debug = 1</div>
<p>Another thing that took me ages to figure out from reading on the links above, what is actually <strong>/full/path/to/your/application</strong> supposed to point at?? I tried /var/turbogears/newproject/newproject-start-scgi.py (which is the new script I created by following the instructions) and /var/turbogears/newproject/ etc.<br />
<br />
the correct answer is <strong>/var/turbogears/newproject/newproject</strong> (i.e. the folder where the application is UNDER the project, they are named the same when using the tg-admin quickstart)</p>
<p>so my lighttpd configuration looks like (after resolving it, I obviously took the debug statements out):</p>
<div class="codesnip-container" >
<div class="apache codesnip" style="font-family:monospace;">server.document-root = <span class="st0">&quot;/var/turbogears/newproject/newproject&quot;</span><br />
<span class="co1">#debug.log-request-handling = &quot;enable&quot;</span><br />
<span class="co1">#scgi.debug = 1</span></p>
<p>$HTTP[<span class="st0">&quot;url&quot;</span>] !~ <span class="st0">&quot;^/static/&quot;</span> {<br />
&nbsp; scgi.server = (<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;/&quot;</span> =&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ( <span class="st0">&quot;127.0.0.1&quot;</span> =&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;host&quot;</span> =&gt; <span class="st0">&quot;127.0.0.1&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;port&quot;</span> =&gt; <span class="nu0">4000</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;check-local&quot;</span> =&gt; <span class="st0">&quot;disable&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
}</div>
</div>
<p>
That didn&#8217;t solve the problem unfortunately. I was getting lots of these errors (in /var/log/lighttpd/error.log), even when running the new modified turbogears script (newproject-start-scgi.py):</p>
<div class="codesnip-container" >2007-09-10 16:38:57: (response.c.258) URI-path     :  /<br />
2007-09-10 16:38:57: (mod_scgi.c.2760) handling it in mod_scgi<br />
2007-09-10 16:38:57: (response.c.372) &#8212; before doc_root<br />
2007-09-10 16:38:57: (response.c.373) Doc-Root     : /var/turbogears/newproject/<br />
2007-09-10 16:38:57: (response.c.374) Rel-Path     : /<br />
2007-09-10 16:38:57: (response.c.375) Path         :<br />
2007-09-10 16:38:57: (response.c.423) &#8212; after doc_root<br />
2007-09-10 16:38:57: (response.c.424) Doc-Root     : /var/turbogears/newproject/<br />
2007-09-10 16:38:57: (response.c.425) Rel-Path     : /<br />
2007-09-10 16:38:57: (response.c.426) Path         : /var/turbogears/newproject/<br />
2007-09-10 16:38:57: (response.c.443) &#8212; logical -> physical<br />
2007-09-10 16:38:57: (response.c.444) Doc-Root     : /var/turbogears/newproject/<br />
2007-09-10 16:38:57: (response.c.445) Rel-Path     : /<br />
2007-09-10 16:38:57: (response.c.446) Path         : /var/turbogears/newproject/<br />
2007-09-10 16:38:57: (mod_scgi.c.1325) connect delayed, will continue later: 7<br />
2007-09-10 16:38:57: (mod_scgi.c.2239) got proc: 7 0  4000 1<br />
2007-09-10 16:38:57: (mod_scgi.c.1179) release proc: 7 0<br />
2007-09-10 16:38:57: (mod_scgi.c.2029) proc: 127.0.0.1 4000  1 0 0 0<br />
2007-09-10 16:38:58: (mod_scgi.c.2029) proc: 127.0.0.1 4000  1 0 0 0<br />
2007-09-10 16:38:59: (mod_scgi.c.2029) proc: 127.0.0.1 4000  1 0 0 0</div>
<p>And at some other point (apologies, don&#8217;t remember exactly when was what)</p>
<div class="codesnip-container" >2007-09-10 16:49:48: (response.c.206) URI-path     :  /<br />
2007-09-10 16:49:48: (response.c.207) URI-query    :<br />
2007-09-10 16:49:48: (response.c.257) &#8212; sanatising URI<br />
2007-09-10 16:49:48: (response.c.258) URI-path     :  /<br />
<strong>2007-09-10 16:49:48: (mod_scgi.c.2825) no fcgi-handler found for: /</strong><br />
2007-09-10 16:49:48: (mod_scgi.c.2029) proc: 127.0.0.1 4000  5 0 0 0<br />
2007-09-10 16:49:49: (mod_scgi.c.2029) proc: 127.0.0.1 4000  5 0 0 0</div>
<p>
After very long googling experience, I came across <a href="http://trac.turbogears.org/ticket/193">this link!</a> and then modified my turbogears startup script as it recommended, but with the following modifications where it said <strong>modulename=&#8221;gtextranet.config.app&#8221;</strong> I changed it to <strong>newproject</strong>.config (without the .app), and obviously the line that now says <strong>from newproject.controllers import Root</strong></p>
<div class="codesnip-container" >
<div class="python codesnip" style="font-family:monospace;"><span class="co1">#!/usr/bin/env python</span><br />
<span class="kw1">import</span> pkg_resources<br />
pkg_resources.<span class="me1">require</span><span class="br0">&#40;</span><span class="st0">&quot;TurboGears&quot;</span><span class="br0">&#41;</span></p>
<p><span class="kw1">import</span> turbogears<br />
<span class="kw1">import</span> cherrypy<br />
cherrypy.<span class="me1">lowercase_api</span> = <span class="kw2">True</span></p>
<p><span class="kw1">from</span> <span class="kw3">os</span>.<span class="me1">path</span> <span class="kw1">import</span> <span class="sy0">*</span><br />
<span class="kw1">import</span> <span class="kw3">sys</span></p>
<p><span class="co1"># first look on the command line for a desired config file,</span><br />
<span class="co1"># if it&#8217;s not on the command line, then</span><br />
<span class="co1"># look for setup.py in this directory. If it&#8217;s not there, this script is</span><br />
<span class="co1"># probably installed</span><br />
<span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> 1:<br />
&nbsp; &nbsp; turbogears.<span class="me1">update_config</span><span class="br0">&#40;</span>configfile=<span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; modulename=<span class="st0">&quot;newproject.config&quot;</span><span class="br0">&#41;</span><br />
<span class="kw1">elif</span> exists<span class="br0">&#40;</span>join<span class="br0">&#40;</span>dirname<span class="br0">&#40;</span>__file__<span class="br0">&#41;</span>, <span class="st0">&quot;setup.py&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>:<br />
&nbsp; &nbsp; turbogears.<span class="me1">update_config</span><span class="br0">&#40;</span>configfile=<span class="st0">&quot;dev.cfg&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; modulename=<span class="st0">&quot;newproject.config&quot;</span><span class="br0">&#41;</span><br />
<span class="kw1">else</span>:<br />
&nbsp; &nbsp; turbogears.<span class="me1">update_config</span><span class="br0">&#40;</span>configfile=<span class="st0">&quot;prod.cfg&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; modulename=<span class="st0">&quot;newproject.config&quot;</span><span class="br0">&#41;</span></p>
<p><span class="kw1">from</span> newproject.<span class="me1">controllers</span> <span class="kw1">import</span> Root<br />
<span class="kw1">from</span> cherrypy._cpwsgi <span class="kw1">import</span> wsgiApp<br />
<span class="co1">#from paste.util.scgiserver import serve_application</span><br />
<span class="kw1">from</span> flup.<span class="me1">server</span>.<span class="me1">scgi</span> &nbsp;<span class="kw1">import</span> WSGIServer<br />
<span class="co1">#from flup.server.scgi_fork &nbsp;import WSGIServer</span></p>
<p>port = 4000<br />
<span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> 2:<br />
&nbsp; &nbsp; port = <span class="kw2">int</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span><span class="br0">&#41;</span></p>
<p>cherrypy.<span class="me1">config</span>.<span class="me1">update</span><span class="br0">&#40;</span><span class="br0">&#123;</span><br />
<span class="st0">&#8216;global&#8217;</span>: <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="st0">&#8216;autoreload.on&#8217;</span>: <span class="kw2">False</span>,<br />
<span class="br0">&#125;</span><span class="br0">&#125;</span><span class="br0">&#41;</span><br />
cherrypy.<span class="me1">root</span> = Root<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
cherrypy.<span class="me1">server</span>.<span class="me1">start</span><span class="br0">&#40;</span>initOnly=<span class="kw2">True</span>, serverClass=<span class="kw2">None</span><span class="br0">&#41;</span><br />
<span class="co1">#serve_application(application=wsgiApp, prefix=&#8217;/', port=port)</span><br />
WSGIServer<span class="br0">&#40;</span>application=wsgiApp, bindAddress=<span class="br0">&#40;</span><span class="st0">&#8216;localhost&#8217;</span>, port<span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">run</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</div>
<p></p>
<p>Don&#8217;t ask me what made the difference with this script, as I said before I know nothing about python or turbogears, but it seemed to work.<br />
I had to launch the new script</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="sy0">/</span>var<span class="sy0">/</span>turbogears<span class="sy0">/</span>newproject <span class="co0">#./newproject-start-scgi.py</span></div>
</div>
<p>last thing I did was to set up a bash script to launch this newproject-start-scgi.py script when the system boots. I used a rather basic bash script placed under /etc/init.d:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="co0">#!/bin/sh</span><br />
<span class="re2">SCRIPT</span>=<span class="st0">&quot;/var/turbogears/newproject/newproject-start-scgi.py&quot;</span><br />
<span class="kw1">case</span> <span class="st0">&quot;$1&quot;</span> <span class="kw1">in</span><br />
start<span class="br0">&#41;</span> &nbsp;<span class="kw3">echo</span> <span class="st0">&quot;STARTING <span class="es2">$SCRIPT</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re1">$SCRIPT</span> <span class="sy0">&amp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">;;</span><br />
stop<span class="br0">&#41;</span> &nbsp; <span class="kw3">echo</span> <span class="st0">&quot;STOP <span class="es2">$SCRIPT</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re2">pid</span>=<span class="sy0">`/</span>bin<span class="sy0">/</span><span class="kw2">ps</span> <span class="re5">-ef</span> <span class="sy0">|</span> <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span><span class="kw2">awk</span> <span class="st_h">&#8216;($9~&quot;newproject&quot; &amp;&amp; $3==1){printf &quot; &quot;$2}&#8217;</span><span class="sy0">`</span><br />
<span class="co0">##</span><br />
<span class="co0">## please check if this computation of pid is correct on your system</span><br />
<span class="co0">##</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-n</span> <span class="st0">&quot;<span class="es2">$pid</span>&quot;</span> <span class="br0">&#93;</span>; <span class="kw1">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">/</span>bin<span class="sy0">/</span><span class="kw2">kill</span> <span class="re1">$pid</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">fi</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">;;</span><br />
<span class="sy0">*</span><span class="br0">&#41;</span> &nbsp; &nbsp; &nbsp;<span class="kw3">echo</span> <span class="st0">&quot;Usage: $0 {start|stop}&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">exit</span> 2<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">;;</span><br />
<span class="kw1">esac</span><br />
<span class="kw3">exit</span> <span class="nu0">0</span></div>
</div>
<p>Even this script is probably crap and shows my lack of refined (or even basic) bash scripting experience, but it seemed to do the trick too</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gingerlime.com/turbogears-lighttpd-and-wsgi-for-real-dummies/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
