<?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>[LINICKX].com &#187; bash</title>
	<atom:link href="http://www.linickx.com/tag/bash/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linickx.com</link>
	<description>Moments of Genius followed by Trash.</description>
	<lastBuildDate>Tue, 07 Feb 2012 15:06:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Building a free Dynamic DNS client with rackspace Cloud</title>
		<link>http://www.linickx.com/3442/building-a-free-dynamic-dns-client-with-rackspace-cloud</link>
		<comments>http://www.linickx.com/3442/building-a-free-dynamic-dns-client-with-rackspace-cloud#comments</comments>
		<pubDate>Sun, 30 Oct 2011 21:46:36 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[rsdns]]></category>

		<guid isPermaLink="false">http://www.linickx.com/?p=3442</guid>
		<description><![CDATA[As a cloud server customer you get access to rackspace&#8217;s free DNS service. When I fist saw this product I had an instance light-bulb moment, I could stop paying for a dynamic DNS service and build my own private one. &#8230; <a href="http://www.linickx.com/3442/building-a-free-dynamic-dns-client-with-rackspace-cloud">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rackspace.com/cloud/cloud_hosting_products/dns/"><img src="http://www.linickx.com/files/2011/10/rsdns.png" alt="" title="rsdns" width="200" height="173" class="alignright size-full wp-image-3447" /></a><br />
As a <a href="http://www.rackspace.co.uk/cloud-hosting/cloud-products/cloud-servers/">cloud server</a> customer you get access to <a href="http://www.rackspace.com/cloud/cloud_hosting_products/dns/">rackspace&#8217;s free DNS service</a>.</p>
<p>When I fist saw this product I had an instance light-bulb moment, I could stop paying for a dynamic DNS service and build my own private one. As a broadband (DHCP) user I have a very basic requirement of needing to regularly update an A record so that I can find my pc <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To bring my idea into fruition I began researching; I need a cli tool which I could run from cron on my linux box (<em>to send the DNS update requests to rackspace</em>). In my research I found <a href="https://github.com/jsquared">rscurl</a>, a cli tool to control cloud servers, as rackspace have a standard API for all their products I have been able to use rscurl to develop <a href="https://github.com/linickx/rsdns">rsdns.</a></p>
<p>rsdns is a series of cli tools to adding/deleting/changing rackspace DNS records, as part of the tool development I have created a script called <code>rsdns-dc.sh</code> to run on my machine, below is a short how to:</p>
<p><strong>How to get free dynamic dns from rackspace.</strong></p>
<p><span id="more-3442"></span></p>
<p><u>Pre-requisit</u>: This is for linux/mac, if you want to do this on windows you&#8217;ll need bash, curl, awk, sed &amp; dig installed &#8211; google is your friend.</p>
<p>The instructions below assume that you (a) have a domain and (b) have already changed your NS records to point to dns1.stabletransit.com &#038; dns2.stabletransit.com. </p>
<p><a href="https://github.com/linickx/rsdns/tarball/master">Download the latest rsdns from gitgub</a> and unpack somewhere, I like <code>~/bin/rsdns</code>.</p>
<p>Go to your rackspace management portal and grap your username &amp; API key (<em>It&#8217;s under &#8220;Your Account&#8221; -&gt; &#8220;API Access&#8221;</em>)</p>
<p>Create a config file for rsdns (<code>~/.rsdns_config</code>) with your settings.</p>
<pre class="brush: bash; title: ; notranslate">
RSUSER=linickx
RSAPIKEY=123456
RSPATH=~/bin/rsdns/
</pre>
<p>You need your domain <em>created</em> on rackspace, you can either use rackspaces GUI to do this (<em>It&#8217;s under &#8220;Hosting&#8221; -&gt; &#8220;Cloud Servers&#8221; -&gt; &#8220;serverabc&#8221; -&gt; &#8220;DNS&#8221; </em>) or you can use rsdns, like so.</p>
<pre class="brush: bash; title: ; notranslate">
[LINICKX@SERVER rsdns]$./rsdns-domain.sh -d www.linickx.com -e spam@linickx.com
</pre>
<p>Once you have a domain setup you need an A record, this step was a deliberate design to avoid any rouge cron jobs from creating a million records, the dynamic client will only update an existing record &#8211; not create a new one. </p>
<p>To create the a record you going to need an IP address, it can be something random like the below, or you can use <a href="http://icanhazip.com">http://icanhazip.com</a> to get your actual current IP. Again to create a record, you can use the rackspace GUI (<em>It&#8217;s under &#8220;Hosting&#8221; -&gt; &#8220;Cloud Servers&#8221; -&gt; &#8220;serverabc&#8221; -&gt; &#8220;DNS&#8221; -&gt; &#8220;yourdomain&#8221; &gt; &#8220;Add&#8221;</em>) or you can use rsdns&#8230;.</p>
<pre class="brush: bash; title: ; notranslate">
[LINICKX@SERVER rsdns]$./rsdns-a.sh -n dynamichost.linickx.com -i 123.123.123.123 -t 3600
</pre>
<p>In the above the TTL is set to 1hr, this is so that DNS caches do not keep the record too long. That&#8217;s all the pre-work done, now lets get your dynamic host setup!</p>
<p>The script to update your a record is <code>rsdns-dc.sh</code>, and you run it like this&#8230;</p>
<pre class="brush: bash; title: ; notranslate">
[LINICKX@SERVER rsdns]$./rsdns-dc.sh -n dynamichost.linickx.com
</pre>
<p>Easy huh? The script uses icanhazip to get your current IP, it then update the A record with it.</p>
<p>I never switch off my router so I have create a created a cronjob to run that script every 2 hours, plus the 1hr TTL <em>should</em> mean that the record is roughly in sync with my IP without making unnecessary requests &#8211; You can run the script more often if you like, just stay under the limits &#8211;&gt; according to <a href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/Rate_Limits-d1e1222.html">the API guidelines</a> you can make upto 25 changes per min / 2 per second.</p>
<p>I use redhat based linux systems, so I can simply drop the following file called rsdns-dc into <code>/etc/cron.d/</code> with this&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
* */2  * * *     linickx /home/linickx/bin/rsdns/rsdns-dc.sh -n dynamichost.linickx.com &amp;&gt;/dev/null
</pre>
<p>Now we are actually done! Free private Dynamic DNS on your own zone, what more could you want?</p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/3442/building-a-free-dynamic-dns-client-with-rackspace-cloud/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Cisco ASA Firewalls and IP Ranges in ACLS</title>
		<link>http://www.linickx.com/3205/cisco-asa-firewalls-and-ip-ranges-in-acls</link>
		<comments>http://www.linickx.com/3205/cisco-asa-firewalls-and-ip-ranges-in-acls#comments</comments>
		<pubDate>Fri, 29 Jul 2011 15:05:55 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[asa]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.linickx.com/?p=3205</guid>
		<description><![CDATA[I&#8217;ve google&#8217;d and I cannot find a way of creating a firewall range style object in an ASA, you know the kind of thing whereby you want to allow IP addresses 192.168.1.10 thru 192.168.1.20 in an ACL. In my frustration &#8230; <a href="http://www.linickx.com/3205/cisco-asa-firewalls-and-ip-ranges-in-acls">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve google&#8217;d and I cannot find a way of creating a firewall range style object in an ASA, you know the kind of thing whereby you want to allow IP addresses 192.168.1.10 thru 192.168.1.20 in an ACL.</p>
<p>In my frustration I have given up and created a shell script which converts a CSV into an ASA output, simply create a two column CSV with Col A containing your starting IP and Col B containing you end IP.</p>
<p>The script is a recursive loop so should support large outputs such as 10.1.2.10 to 10.2.1.20 howvere I&#8217;m not actually sure you&#8217;d want that in your firewall config but I wrote the computability for the fun it!</p>
<p>Have fun, click &#8220;more&#8221; below if you can&#8217;t see the script!</p>
<p><span id="more-3205"></span></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash

# Commas separated VAR....
IFS=&quot;,&quot;
while read name firstip lastip
# Loop around CSV
do

# Split up our first ip into it's octects
firstipfirstoctect=$(echo $firstip | awk -F &quot;.&quot; '{print $1}')
firstipsecondoctect=$(echo $firstip | awk -F &quot;.&quot; '{print $2}')
firstipthirdoctect=$(echo $firstip | awk -F &quot;.&quot; '{print $3}')
firstipforthoctect=$(echo $firstip | awk -F &quot;.&quot; '{print $4}')

# Split up our last IP into it's ocects
lastipfirstoctect=$(echo $lastip | awk -F &quot;.&quot; '{print $1}')
lastipsecondoctect=$(echo $lastip | awk -F &quot;.&quot; '{print $2}')
lastipthirdoctect=$(echo $lastip | awk -F &quot;.&quot; '{print $3}')
lastipforthoctect=$(echo $lastip | awk -F &quot;.&quot; '{print $4}')

	# Re-set BASH
	unset IFS 

	# Echo out the object GROUP name
	echo &quot;object-group network $name&quot;

	# Loop through 1st Octect
	for a in `seq $firstipfirstoctect $lastipfirstoctect`;
	do
		# test to see if we need to print the whole range
		if [ $firstipfirstoctect -lt $lastipfirstoctect ]
		then
			firstipsecondoctectCOUNTER=&quot;0&quot;
			lastipsecondoctectCOUNTER=&quot;255&quot;
		fi

		# first IP might not be 1
		if [ $a -eq $firstipfirstoctect ]
		then
			firstipsecondoctectCOUNTER=$firstipsecondoctect
		fi

		# last IP might not be 255
		if [ $a -eq $lastipfirstoctect ]
		then
			lastipsecondoctectCOUNTER=$lastipsecondoctect
		fi

			# Loop through 2nd Octect
			for b in `seq $firstipsecondoctect $lastipsecondoctect`;
			do

				# Same tests as before except, next octect.
				if [ $firstipsecondoctect -lt $lastipsecondoctect ]
				then
					firstipthirdoctectCOUNTER=&quot;0&quot;
					lastipthirdoctectCOUNTER=&quot;255&quot;
				fi

				if [ $b -eq $firstipsecondoctect ]
				then
					firstipthirdoctectCOUNTER=$firstipthirdoctect
				fi

				if [ $b -eq $lastipsecondoctect ]
				then
					lastipthirdoctectCOUNTER=$lastipthirdoctect
				fi

					# Loop through 3rd Octect
					for c in `seq $firstipthirdoctectCOUNTER $lastipthirdoctectCOUNTER`;
					do

						# copy / paste / tweak
						if [ $firstipthirdoctect -lt $lastipthirdoctect ]
						then
							firstipforthoctectCOUNTER=&quot;0&quot;
							lastipforthoctectCOUNTER=&quot;255&quot;
						fi

						if [ $c -eq $firstipthirdoctect ]
						then
							firstipforthoctectCOUNTER=$firstipforthoctect
						fi

						if [ $c -eq $lastipthirdoctect ]
						then
							lastipforthoctectCOUNTER=$lastipforthoctect
						fi

							# final octect... echo result.
							for d in `seq $firstipforthoctectCOUNTER $lastipforthoctectCOUNTER`;
							do
								echo &quot; network-object $a.$b.$c.$d  255.255.255.255&quot;
							done

					done
			done
	done

done&lt;./FirewallRanges.csv
</pre>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/3205/cisco-asa-firewalls-and-ip-ranges-in-acls/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GTD in your Shell</title>
		<link>http://www.linickx.com/3267/gtd-in-your-shell</link>
		<comments>http://www.linickx.com/3267/gtd-in-your-shell#comments</comments>
		<pubDate>Tue, 26 Apr 2011 21:27:48 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[GTD]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[t]]></category>

		<guid isPermaLink="false">http://www.linickx.com/?p=3267</guid>
		<description><![CDATA[For the last few months I&#8217;ve felt better at managing my actions and tasks thanks to Steve Losh&#8217;s T. T is a simple python script that allows you to manage a simple task list from your shell prompt. I use &#8230; <a href="http://www.linickx.com/3267/gtd-in-your-shell">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For the last few months I&#8217;ve felt better at managing my actions and tasks thanks to <a href="http://stevelosh.com/projects/t/">Steve Losh&#8217;s T</a>. T is a simple python script that allows you to manage a simple task list from your shell prompt.</p>
<p>I use my shell all the time to ping stuff, renice processes and you know, whatever (<em>like in the image below</em>)&#8230;..</p>
<p><a href="http://www.linickx.com/files/2011/04/GTD_iTerm.png" rel="lightbox[3267]"><img src="http://www.linickx.com/files/2011/04/GTD_iTerm-300x146.png" alt="Screenshot of T in iTerm" title="Getting Things Done in my Terminal" width="300" height="146" class="aligncenter size-medium wp-image-3269" /></a></p>
<p>&#8230; having my todo list right there in front of me has been really helpful (<em>The numbers in the square brackets!</em>). Steve&#8217;s website suggests a quick update to your shell profile to add your task list to your prompt but I found running a python script each time I do anything quite slow, especially since I have two lists.</p>
<p>Below is my bash .profile file, there you can see the rather <abbr title="yes, I mean over the top!">OTT</abbr> change(s) I&#8217;ve made to integrate my todo lists into my shell prompt. I have two lists (<em>work &#038; personal</em>) the number of things to do shown in my shell prompt gets updated each time the lists change (<em>thanks to md5</em>)&#8230;. and I hide my work list over the weekend  <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<pre class="brush: bash; title: ; notranslate">
alias p='python ~/bin/t/t.py --task-dir ~/Dropbox/Tasks --list personal.tasks --delete-if-empty'
alias w='python ~/bin/t/t.py --task-dir ~/Dropbox/Tasks --list work.tasks --delete-if-empty'

function nick_PS1 {

        if [ -e &quot;/Users/nick/Dropbox/Tasks/Personal.tasks&quot; ]
        then
                CurrentPersonalMD5=`md5 ~/Dropbox/Tasks/Personal.tasks | awk '{print $4}' | cat `

                if [ -e &quot;~/.tasks.personal.md5&quot; ]
                then
                        LastPersonalMD5=`cat ~/.tasks.personal.md5`
                fi

                if [ &quot;$CurrentPersonalMD5&quot; == &quot;$LastPersonalMD5&quot; ]
                then
                        if [ -e &quot;~/.tasks.personal.no&quot; ]
                        then
                                NumOfPersonal=`cat ~/.tasks.personal.no`
                        fi
                else
                        NumOfPersonal=`p | wc -l | sed -e's/ *//'`
                        echo $NumOfPersonal &gt; ~/.tasks.personal.no
                        echo $CurrentPersonalMD5 &gt; ~/.tasks.personal.md5
                fi

                if [ $NumOfPersonal -ne 0 ]
                then
                        LEFT='['
                        RIGHT=']'
                        Personal=&quot;p:$NumOfPersonal&quot;
                fi

        else
                NumOfPersonal=0
        fi

DayOfWeek=`date &quot;+%u&quot;`
if [ $DayOfWeek -lt 6 ]
then
        if [ -e &quot;/Users/nick/Dropbox/Tasks/Work.tasks&quot; ]
        then
                CurrentWorkMD5=`md5 ~/Dropbox/Tasks/Work.tasks | awk '{print $4}'`

                if [ -e &quot;~/.tasks.work.md5&quot; ]
        then
                LastWorkMD5=`cat ~/.tasks.work.md5`
        fi

                if [ &quot;$CurrentWorkMD5&quot; == &quot;$LastWorkMD5&quot; ]
        then
                        if [ -e &quot;~/.tasks.work.no&quot; ]
                        then
                                NumOfWork=`cat ~/.tasks.work.no`
                        fi
                else
                                        NumOfWork=`w | wc -l | sed -e's/ *//'`
                                        echo $NumOfWork &gt; ~/.tasks.work.no
                                        echo $CurrentWorkMD5 &gt; ~/.tasks.work.md5
                fi

                if [ $NumOfWork -ne 0 ]
                then
                        LEFT='['
                        RIGHT=']'
                        Work=&quot;w:$NumOfWork&quot;
                fi

        else
                NumOfWork=0
        fi
else
 NumOfWork=0
fi

        if [ $NumOfPersonal -ne 0 ]
        then
                if [ $NumOfWork -ne 0 ]
                then
                        SEP=&quot;|&quot;
                fi
         fi

        RESULT=&quot;$LEFT$Personal$SEP$Work$RIGHT&quot;

        if [ -z $RESULT ]
        then
                RESULT=&quot;linickx@macbookpro&quot;
        fi

        echo $RESULT
}

export PS1=&quot;\$(nick_PS1) \W \$&quot;
</pre>
<p>&#8230; I think my next stop will be using geektool show the list/reminders on my desktop.</p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/3267/gtd-in-your-shell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lowing VirtualBox priorities</title>
		<link>http://www.linickx.com/3212/lowing-virtualbox-priorities</link>
		<comments>http://www.linickx.com/3212/lowing-virtualbox-priorities#comments</comments>
		<pubDate>Mon, 14 Feb 2011 17:30:01 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://www.linickx.com/?p=3212</guid>
		<description><![CDATA[One of the things I&#8217;d really like is process priorities for virtual box. In the forum I posted a couple of shell commands that I regularly type&#8230; which gets a bit tedious, following a recent article on lifehacker reviewing mac &#8230; <a href="http://www.linickx.com/3212/lowing-virtualbox-priorities">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the things <a href="http://forums.virtualbox.org/viewtopic.php?f=9&#038;t=34341">I&#8217;d really like</a> is process priorities for virtual box. In the forum I posted a couple of shell commands that I regularly type&#8230; which gets a bit tedious, following a recent article on lifehacker <a href="http://lifehacker.com/#!5749631/the-mac-text-expansion-face-off">reviewing mac text expanding</a> I&#8217;ve been prompted to automate a few things&#8230; below is a little shell script to lower the priority (<em>renice</em>) of all running virtual machines.</p>
<p>The advantage of doing this is that your host machine stays snappy, responsive and won&#8217;t get too over-loaded by jobs on your VMs!</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
ps -xo pid,command | grep -v grep | grep startvm | while read line ;
do
        procID=`echo $line | awk '{print $1}'`
        sudo renice +10 -p $procID
done
</pre>
<p>The above code works on a mac; although I haven&#8217;t tested it, I recon to get it running on Linux you need to update the PS command, by swapping the x for an e&#8230; like this&#8230;. </p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
ps -eo pid,command | grep -v grep | grep startvm | while read line ;
do
        procID=`echo $line | awk '{print $1}'`
        sudo renice +10 -p $procID
done
</pre>
<p>Have fun, suggestions and improvements welcome.</p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/3212/lowing-virtualbox-priorities/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash script to fix file permissions recursively</title>
		<link>http://www.linickx.com/396/bash-script-to-fix-file-permissions-recursively</link>
		<comments>http://www.linickx.com/396/bash-script-to-fix-file-permissions-recursively#comments</comments>
		<pubDate>Thu, 26 Jun 2008 19:00:47 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[mediatomb]]></category>

		<guid isPermaLink="false">http://www.linickx.com/?p=396</guid>
		<description><![CDATA[I love the redhat implementation of cron, simply drop a shell script into /etc/cron.daily/ and your script will be executed every day (by default at 4am). Recently I&#8217;ve been having a small problem with mediatomb, further investigation lead me to &#8230; <a href="http://www.linickx.com/396/bash-script-to-fix-file-permissions-recursively">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I love the redhat implementation of cron, simply drop a shell script into <code>/etc/cron.daily/</code> and your script will be executed every day (<em>by default at 4am</em>).</p>
<p>Recently I&#8217;ve been having a small <a href="https://sourceforge.net/forum/forum.php?thread_id=1961180&#038;forum_id=440751">problem</a> with <a href="http://mediatomb.cc/">mediatomb</a>, further investigation lead me to <a href="https://sourceforge.net/forum/message.php?msg_id=4828164">a &#8220;Inotify thread caught exception&#8221; error</a> which can be fixed by recursively resetting your file permissions.</p>
<p>What I have done to fix the issue is save the following code as <code>/etc/cron.daily/fix_mt.sh</code> and &#8216;jobs a gooden&#8217; <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_cool.gif' alt=':cool:' class='wp-smiley' /> </p>
<pre>
#!/bin/bash
# Load up your mediatomb directories...
MediaTombDirectories[0]="/home/me/Videos"
MediaTombDirectories[1]="/home/me/Music"
# add more if needbe
# MediaTombDirectories[2]="/home/me/files"

# Setup find correctly.
export IFS=$'\n'

# Loop through our array.
for x in ${MediaTombDirectories[@]}
	do
		# Find all directories &#038; subdirectories
		for i in $(find $x -type d)
			do
				# Fix Permissions
				chmod -c 775 $i
				chown -c me:user $i
			done

		# Find all Files
		for i in $(find $x -type f)
			do
				# Fix Permissions
				chmod -c 664 $i
				chown -c me:user $i
			done
	done
</pre>
<p><strong><br />
Quick tip:</strong> You (<em>or root</em>) will get e-mailed every time this executes, you can make the script more verbos by changing all &#8220;<code>-c</code>&#8221; to &#8220;<code>-v</code>&#8220;, or make it silent by removing the &#8220;<code>-c</code>&#8221; altogether.</p>
<p>Enjoy!</p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/396/bash-script-to-fix-file-permissions-recursively/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>History Meme &#8211; What&#8217;s your shell top 10?</title>
		<link>http://www.linickx.com/404/history-meme-whats-your-shell-top-10</link>
		<comments>http://www.linickx.com/404/history-meme-whats-your-shell-top-10#comments</comments>
		<pubDate>Fri, 18 Apr 2008 09:51:51 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[history meme]]></category>

		<guid isPermaLink="false">http://www.linickx.com/archives/404/history-meme-whats-your-shell-top-10</guid>
		<description><![CDATA[Planet gnome have started a trend&#8230; $ history &#124; awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' &#124; sort -rn &#124; head 114 ping 107 sudo 82 ssh 71 top 71 cd 68 iwconfig 56 ls 46 usbkey.sh 43 ps &#8230; <a href="http://www.linickx.com/404/history-meme-whats-your-shell-top-10">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.google.com/custom?hl=en&#038;client=google-coop&#038;cof=AH%3Aleft%3BS%3Ahttp%3A%2F%2Fplanet.gnome.org%2F%3BCX%3ABloggers%2520of%2520Planet%2520GNOME%3BL%3Ahttp%3A%2F%2Fwww.gnome.org%2Fimg%2Flogo%2Ftext-64%3BLH%3A64%3BLP%3A1%3BGFNT%3A%23666666%3BDIV%3A%23cccccc%3B&#038;adkw=AELymgVuQoYfvsheM6KA6z8eBquUjnbxaM51ouim04L3q497yAuT4d5y7BOqpREvwI7hHZLLATbHsG16s_IindkbId-BmIBZDBTPTxGSBe-1lcUh4VPn8o0JuwbPpxnaNMefCT5vj5Tt&#038;q=awk+print+sort+head&#038;btnG=Search&#038;cx=007525575524326405779%3Ac0gv0y410u0">Planet gnome have started a trend</a>&#8230;</p>
<pre>
$ history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
114 ping
107 sudo
82 ssh
71 top
71 cd
68 iwconfig
56 ls
46 usbkey.sh
43 ps
33 evolution
</pre>
<p>The output shows what commands you type the most, <code>usbkey.sh</code> is a script to unlock the secret-keys held on my usb key-fob, sudo is high up probably cause I use sudo to bounce services (<em>the intel wireless drive crashes quite alot and both it and Network Manager then need restarting</em>) and evolution needs a shutdown every now and again <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  The other commands are fairly self-explanatory.</p>
<p>So what&#8217;s your history? </p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/404/history-meme-whats-your-shell-top-10/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bash looping through directories &amp; sub-directoires</title>
		<link>http://www.linickx.com/364/bash-looping-through-directories-sub-directoires</link>
		<comments>http://www.linickx.com/364/bash-looping-through-directories-sub-directoires#comments</comments>
		<pubDate>Tue, 05 Feb 2008 11:18:19 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.linickx.com/archives/364/bash-looping-through-directories-sub-directoires</guid>
		<description><![CDATA[Note to self&#8230;. If I want to &#8220;do&#8221; something to all files in all sub-directories then I need&#8230;.. #!/bin/bash export IFS=$'\n' for i in $(find $1 -type f) do echo "$i" done Copyright &#169; 2012 [LINICKX].com. This Feed is for &#8230; <a href="http://www.linickx.com/364/bash-looping-through-directories-sub-directoires">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Note to self&#8230;. If I want to &#8220;do&#8221; something to all files in all sub-directories then I need&#8230;..</p>
<p><code><br />
#!/bin/bash<br />
export IFS=$'\n'<br />
for i in $(find $1 -type f)<br />
	do<br />
		echo "$i"<br />
	done<br />
</code></p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/364/bash-looping-through-directories-sub-directoires/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

