<?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>N3QO &#187; G1TLH</title>
	<atom:link href="http://n3qo.com/archives/tag/g1tlh/feed" rel="self" type="application/rss+xml" />
	<link>http://n3qo.com</link>
	<description></description>
	<lastBuildDate>Sat, 17 Jul 2010 15:29:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>DXspider US callsign database</title>
		<link>http://n3qo.com/archives/608</link>
		<comments>http://n3qo.com/archives/608#comments</comments>
		<pubDate>Wed, 23 Dec 2009 05:50:44 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
				<category><![CDATA[DX Spider]]></category>
		<category><![CDATA[callsign database]]></category>
		<category><![CDATA[dxspider]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[G1TLH]]></category>
		<category><![CDATA[gen_usdb_data.pl]]></category>
		<category><![CDATA[n3qo]]></category>
		<category><![CDATA[state]]></category>
		<category><![CDATA[usdb]]></category>
		<category><![CDATA[usdbraw.gz]]></category>

		<guid isPermaLink="false">http://n3qo.com/?p=608</guid>
		<description><![CDATA[While troubleshooting the filtering functions of my DXspider installation, I found there was very little documentation on how to get filtering to actually work. For the uninitiated, browse to the bottom of this post if you only require an updated version of usdbraw.gz from 12/23/09. First I started with G1TLH&#8217;s download documentation. It references a [...]]]></description>
			<content:encoded><![CDATA[<p>While troubleshooting the filtering functions of my DXspider installation, I found there was very little documentation on how to get filtering to  actually work. For the uninitiated, browse to the bottom of this post if you only require an updated version of <strong>usdbraw.gz</strong> from 12/23/09.</p>
<p>First I started with <a target=_blank href="http://www.dxcluster.org/download/">G1TLH&#8217;s download documentation</a>. It references a file named <strong>usdbraw.gz</strong> which was unfortunately unavailable at the time. After a brief google search, I found the file, expecting it to only contain states and cities, but instead it IS the US FCC callsign database. The newest one I found was from 2004. Importing this database would make state filtering spuratic at best since so many new callsigns have been issued in the US of the course of the last 5 years and DXspider would only filter callsigns it knew about.</p>
<p>The FCC provides a <a target=_blank href="http://wireless.fcc.gov/uls/data/complete/l_amat.zip">daily updated database archive</a> on their site available for download. Their database structure by itself is not compatible with DXspider and requires massaging of the data to ready it for import.</p>
<p>A huge find in this process was G1TLH&#8217;s <a target=_blank href="http://www.koders.com/perl/fidF2BFC11A1E860B9FAA7C5E9250D8A48FA630AA40.aspx?s=spider">USDB generation script</a>. Dirk&#8217;s script takes the compressed FCC archive and converts it into DXspider format which happens to be output as <strong>usdbraw.gz</strong>.</p>
<p>Taken that process, then reverting back to the <a target=_blank href="http://www.dxcluster.org/download/">download documentation</a>, then importing the database renders a newly up-to-date reference to apply state filters against.</p>
<p>This is great, but new callsigns are generated daily and I wanted to keep DXspider as up-to-date as possible with little to no administrative intervention from me. Introduce a little scripting and the use of cron.</p>
<p>My shell scripting skills a disasterous at best but it does function as advertised. I named my script <strong>usdb-update.sh</strong> and wrote it in <strong>/spider/local_cmds</strong>. It seemed to be the most obvious place for it at the time. Now let&#8217;s step through the script:</p>
<li>We start with the usual shell scripting stuff. Let&#8217;s set variables to our paths. Just in case one day we want to move all this stuff to a new location, it makes life a little easier.</li>
<p><code>#!/bin/sh<br />
SPIDERDATA=/spider/data<br />
SPIDERPERL=/spider/perl</code></p>
<li>Let&#8217;s download the the FCC database via <strong>wget</strong> and store it in <strong>/spider/data</strong>. Don&#8217;t mind formating below&#8230;</li>
<p><code>wget -P $SPIDERDATA http://wireless.fcc.gov/uls/data/complete/l_amat.zip</code></p>
<li>I placed Dirk&#8217;s script in <strong>/spider/perl</strong> will all the other scripts. Let&#8217;s call that script against our newly downloaded FCC database and convert it into something DXspider can understand. This actually creates the <strong>usdbraw.gz</strong> file you&#8217;ve probably been scavenging the internet for. It stores it in <strong>/spider/data</strong></li>
<p><code>$SPIDERPERL/gen_usdb_data.pl $SPIDERDATA/l_amat.zip</code></p>
<li>Now take that output and create the USDB from it.</li>
<p><code>$SPIDERPERL/create_usdb.pl $SPIDERDATA/usdbraw.gz</code></p>
<li>Now cleanup our mess. Disk space is valuable.</li>
<p><code>rm $SPIDERDATA/l_amat.zip<br />
rm $SPIDERDATA/usdbraw.gz</code></p>
<p>At this point if all has gone swimmingly you have the US callsign database waiting for you in DXspider. We now have to load it to make it available to our cluster users.</p>
<p>Telnet to your cluster, login as your privileged callsign and load the database:<br />
<b>load/usdb</b></p>
<li>OK we&#8217;re functional, but let&#8217;s automate it starting in reverse. Edit your <strong>/spider/local_cmd/crontab</strong> and append the following entry:</li>
<p><code>30 5 * * * run_cmd('load/usdb')</code><br />
So my cron entry above executes the command <strong>load/usdb</strong> within the cluster environment every day at 5:30AM GMT.</p>
<p>Since the previous cron entry only works within the cluster environment, I need to execute the data collection process external to DXspider.</p>
<li>Log into the shell of your DXspider server as the sysop user and create your crontab (typing crontab -e).</li>
<p><code>[sysop@dxspider1 ~]$ crontab -e</code><br />
Append the following entry into the sysop user&#8217;s crontab<br />
<code>00 5 * * * /spider/local_cmd/usdb-update.sh</code></p>
<li>Save and close your cron.</li>
<p>I&#8217;ve decided to run the usdb-update.sh we detailed earlier at 5:00AM GMT. In practice I&#8217;ve found the data collection and processing only took 5 minutes so to execute the actual load of the database in DXspider 30 minutes later was plenty of time. This allows for internet or server slowness. Feel free to set these times however it suits your needs.</p>
<p>Below are the files I&#8217;ve referenced in the above documentation:<br />
<a target=_blank href="http://www.n3qo.com/files/N3QO_dxspider.zip">G1TLH&#8217;s gen_usdb_data Perl script and my data collection script</a><br /><br />
<a target=_blank href="http://www.n3qo.com/files/usdbraw.gz">usdbraw.gz created 12/23/09</a><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://n3qo.com/archives/608/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
