<?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>Johannes Buchner &#187; fun with Linux</title>
	<atom:link href="http://johannes.jakeapp.com/blog/category/category/fun-with-linux/feed" rel="self" type="application/rss+xml" />
	<link>http://johannes.jakeapp.com/blog</link>
	<description>Johannes Buchner&#039;s blog about advanced usage of your operating system</description>
	<lastBuildDate>Sun, 18 Jul 2010 08:30:01 +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>Linux: Reiser4 patches</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200911/linux-reiser4-patches</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200911/linux-reiser4-patches#comments</comments>
		<pubDate>Sun, 29 Nov 2009 12:57:12 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>
		<category><![CDATA[FixingTheWorld]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=954</guid>
		<description><![CDATA[I&#8217;ve submitted some patches for reiser4 that make it compile again with the latest git version of the Linux kernel. They can be found here: http://thread.gmane.org/gmane.linux.kernel/919967. We&#8217;ll see if they get picked up by -mm. They were.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve submitted some patches for reiser4 that make it compile again with the latest git version of the Linux kernel. They can be found here: <a href="http://thread.gmane.org/gmane.linux.kernel/919967">http://thread.gmane.org/gmane.linux.kernel/919967</a>. <span style="text-decoration: line-through;">We&#8217;ll see if they get picked up by -mm</span>. They were.</p>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200911/linux-reiser4-patches/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling the Linux kernel for faster boot times</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200909/compiling-the-linux-kernel-for-faster-boot-times</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200909/compiling-the-linux-kernel-for-faster-boot-times#comments</comments>
		<pubDate>Mon, 21 Sep 2009 09:25:08 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=913</guid>
		<description><![CDATA[In this blog entry, I try to investigate easy methods to get a &#8220;faster&#8221; kernel.
Measure
The time of five events are measured:

[1] (printk timing) A very early kernel message, &#8220;ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.AGP_._PRT]&#8221;
This message is buffered until syslog starts, so its date information in /var/log/messages can not be used. The following event allows a [...]]]></description>
			<content:encoded><![CDATA[<p>In this blog entry, I try to investigate easy methods to get a &#8220;faster&#8221; kernel.</p>
<p><strong>Measure</strong></p>
<p>The time of five events are measured:</p>
<ul>
<li>[1] (printk timing) A very early kernel message, &#8220;ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.AGP_._PRT]&#8221;<br />
This message is buffered until syslog starts, so its date information in /var/log/messages can not be used. The following event allows a conversion between the two timings.</li>
<li>[2] (printk timing and date from syslog) The first message when the kernel executes userland: &#8220;Adding 2047888k swap on /dev/hda5&#8243;</li>
<li>[3] (date from syslog) first userland daemon message: &#8220;acpid: starting up with proc fs&#8221;</li>
<li>[4] (date from syslog) first X program message: (seahorse makes a call to gpgme)</li>
<li>[5] (date) a program run by the GNOME session messenger stores the output of date +%S.</li>
</ul>
<p>make clean was performed before each recompile.</p>
<p><strong>System</strong></p>
<p>Gentoo Linux, 64bit, 2.6.30-gentoo-r4 kernel, quite normal End-user system with the GNOME Desktop. HP Pavilion dv8000 single-cpu 2GHz, 1GB RAM.</p>
<h3><strong>Optimizing with -O3, -O2 or -Os?</strong></h3>
<p>People from Gentoo, GCC, the LKML and many others will tell you that using -O3 is not a good idea. Furthermore, O3 it is known to make the kernel instable.</p>
<p>So let&#8217;s try it anyway, and for the fun of it, add -march=native after -m64. We also allow GCC to uninline functions marked as inline.</p>
<p><span id="more-913"></span>I can look at the time differences (in seconds, y-axis) between the events (deltas), relative to one optimization (I chose -Os), and absolute times (zero being system boot):</p>
<p><a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/opt-1.png"><img class="aligncenter size-thumbnail wp-image-915" title="opt-1" src="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/opt-1-200x200.png" alt="opt-1" width="200" height="200" /></a><a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/opt-2.png"><img class="aligncenter size-thumbnail wp-image-916" title="opt-2" src="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/opt-2-200x200.png" alt="opt-2" width="200" height="200" /></a><a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/opt-3.png"><img class="aligncenter size-thumbnail wp-image-914" title="opt-3" src="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/opt-3-200x200.png" alt="opt-3" width="200" height="200" /></a></p>
<p>A average over 3 boot was taken, and the error bars show the standard deviation. Usually, you should take a dot that lies out 3 times the standard deviation seriously. If you now want to complain that you can&#8217;t see the dots in the graph, you are missing the point: The standard deviation is way larger than the difference between the averages.</p>
<p><em>=&gt; It makes absolutely no difference whether you compile the kernel -O3, -O2 or -Os.</em></p>
<p>But: I ran into trouble with -O3, as the cpufreq sysfs-interface hung (blocked io).</p>
<h3>Preemption</h3>
<p>I keep the -Os kernel.</p>
<p>Three options are given for the kernel preemption model: No forced preemption (&#8220;preempt&#8221;),  Voluntary Kernel Preemption (default), preemptible kernel (&#8220;no-preempt&#8221;). Get more information in menuconfig or the kernel documentation.</p>
<p>Again, the same diagrams as above:</p>
<p><a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/preempt-1.png"><img class="aligncenter size-thumbnail wp-image-917" title="preempt-1" src="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/preempt-1-200x200.png" alt="preempt-1" width="200" height="200" /></a><a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/preempt-2.png"><img class="aligncenter size-thumbnail wp-image-918" title="preempt-2" src="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/preempt-2-200x200.png" alt="preempt-2" width="200" height="200" /></a><a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/preempt-3.png"><img class="aligncenter size-thumbnail wp-image-919" title="preempt-3" src="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/preempt-3-200x200.png" alt="preempt-3" width="200" height="200" /></a></p>
<p>One might have the feeling that a preemptible kernel is slower during kernel boot, but faster when executing the userland startup. But again, the standard deviation is way to big, one can not draw a definite conclusion, <em>none of the options out-performs the other</em>.</p>
<p>To make the point clear, the difference between the average boots is less than a second (and yes, this system boots in 60 seconds into the GNOME desktop).</p>
<p>Pretty boring so far, but how would a significant result look like, then?</p>
<h3><!--more-->Scheduler</h3>
<p>I keep the preemptible, -Os kernel.</p>
<p>The kernel got a new scheduler a while ago, CFQ (Completely fair scheduler). (This also gave us the beautiful program ionice).</p>
<p>There are 4 schedulers available, they can be selected by the kernel parameter &#8220;elevator=&#8230;&#8221;: Anticipatory, Deadline, CFQ and No-op. Get more information about them in menuconfig or the kernel documentation.</p>
<p><a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/scheduler-1.png"><img class="aligncenter size-thumbnail wp-image-920" title="scheduler-1" src="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/scheduler-1-200x200.png" alt="scheduler-1" width="200" height="200" /></a><a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/scheduler-2.png"><img class="aligncenter size-medium wp-image-921" title="scheduler-2" src="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/scheduler-2-500x394.png" alt="scheduler-2" width="500" height="394" /></a><a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/scheduler-3.png"><img class="aligncenter size-medium wp-image-922" title="scheduler-3" src="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/scheduler-3-499x426.png" alt="scheduler-3" width="499" height="426" /></a></p>
<p>Now that&#8217;s a real difference: CFQ boots around 9 seconds faster than the others, the standard deviation is around less than 2 seconds.</p>
<p><em>=&gt; CFQ is superior to the other schedulers in this scenario.</em></p>
<p>&#8220;Unfortunately&#8221;, CFQ is already the default scheduler, so the default kernel is already the best choice. Good to know.</p>
<p>All used kernel configs are available as a <a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/configs.tar.bz2">tar file</a>. You can play with the numbers using the <a href="http://johannes.jakeapp.com/blog/wp-content/uploads/2009/09/kernels.gnumeric">gnumeric file</a>.</p>
<p>Watching the disk light, a program like readahead (keeps file content in memory) should be the way to improve startup speed. In my setup, using readahead-list did not change the boot up time.</p>
<p>Parallel boot services (RC_PARALLEL_STARTUP) managed to squeeze out 2-3 seconds to a final boot time of around 58 seconds. At the end you learn the best tools &#8230; <a href="http://www.bootchart.org/">bootchart</a> for example.</p>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200909/compiling-the-linux-kernel-for-faster-boot-times/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sed: Remove lines that match a pattern</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200906/sed-remove-lines-that-match-a-pattern</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200906/sed-remove-lines-that-match-a-pattern#comments</comments>
		<pubDate>Fri, 26 Jun 2009 23:26:41 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>
		<category><![CDATA[hint]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=5</guid>
		<description><![CDATA[
sed  '/mypattern/d' file

Deletes all lines that contain the regular expression &#8220;mypattern&#8221;.
In-place replacement:

sed --in-place '/mypattern/d' file1

sed also supports making backups with e.g. &#8211;in-place=.backup .
]]></description>
			<content:encoded><![CDATA[<p><code>
<pre>sed  '/mypattern/d' file</pre>
<p></code><br />
Deletes all lines that contain the regular expression &#8220;mypattern&#8221;.</p>
<p>In-place replacement:<br />
<code>
<pre>sed --in-place '/mypattern/d' file1</pre>
<p></code><br />
sed also supports making backups with e.g. &#8211;in-place=.backup .</p>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200906/sed-remove-lines-that-match-a-pattern/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shutdown when idle</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200906/shutdown-when-idle</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200906/shutdown-when-idle#comments</comments>
		<pubDate>Fri, 19 Jun 2009 22:24:00 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>
		<category><![CDATA[hint]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=7</guid>
		<description><![CDATA[Maybe you want the computer to shutdown after it has done its task. This shuts down your Linux box when the load goes down to zero. Kind of like the &#8220;Speed&#8221; movies.
while ! cat /proc/loadavg &#124;cut -f2 -d ' '&#124;grep '0\.00'; do sleep 10m; done &#38;&#38; poweroff
Alternatively:
while ps 12345; do sleep 10m; done &#38;&#38; poweroff
]]></description>
			<content:encoded><![CDATA[<p>Maybe you want the computer to shutdown after it has done its task. This shuts down your Linux box when the load goes down to zero. Kind of like the &#8220;Speed&#8221; movies.</p>
<pre><code>while ! cat /proc/loadavg |cut -f2 -d ' '|grep '0\.00'; do sleep 10m; done &amp;&amp; poweroff</code></pre>
<p>Alternatively:</p>
<pre><code>while ps 12345; do sleep 10m; done &amp;&amp; poweroff</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200906/shutdown-when-idle/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash: Chain of commands</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200904/bash-chain-of-commands</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200904/bash-chain-of-commands#comments</comments>
		<pubDate>Sat, 25 Apr 2009 01:23:41 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>
		<category><![CDATA[hint]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=9</guid>
		<description><![CDATA[I wondered more than once how to make a tool that chains together input/output filters using bash. 
e.g. you would like to do a iteration of filters:
for i in 1 2 3 4; do grep -v $i; done
So I wrote this chaining tool that does the job in the obvious way:
chain.sh
#!/bin/bash
commands_file=$1
a=$(mktemp)
b=$(mktemp)
cat &#62; $a
while read line; [...]]]></description>
			<content:encoded><![CDATA[<p>I wondered more than once how to make a tool that chains together input/output filters using bash. <br />
e.g. you would like to do a iteration of filters:</p>
<pre><code lang="bash">for i in 1 2 3 4; do grep -v $i; done</code></pre>
<p>So I wrote this chaining tool that does the job in the obvious way:</p>
<p>chain.sh</p>
<pre><code lang="bash">#!/bin/bash
commands_file=$1
a=$(mktemp)
b=$(mktemp)
cat &gt; $a
while read line; do
$line &lt; $a &gt; $b
mv $b $a
done &lt; $commands_file
cat $a
rm $a</code></pre>
<p>With this, you can do:</p>
<pre><code>for i in 1 2 3 4; do
echo grep -v $i &gt;&gt; mycommands.txt
done
script/chain.sh mycommands.txt</code></pre>
<p> lang=&#8221;bash&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200904/bash-chain-of-commands/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add collaborator to GitHub repository</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200903/add-collaborator-to-github-repository</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200903/add-collaborator-to-github-repository#comments</comments>
		<pubDate>Fri, 06 Mar 2009 13:05:28 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>
		<category><![CDATA[hint]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=20</guid>
		<description><![CDATA[Don&#8217;t let them clone the public url: It doesn&#8217;t go over ssh and I don&#8217;t know how to change the origin url in a branch. *
Steps:

create ssh-key on new collaborators computer (ssh-keygen)
create github user
add public-key to github user account
let the project owner add you as project member
git clone git@&#8230; 

Where 1 &#60; 3, 1 &#60; [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t let them clone the public url: It doesn&#8217;t go over ssh and I don&#8217;t know how to change the origin url in a branch. *</p>
<p>Steps:</p>
<ol>
<li>create ssh-key on new collaborators computer (ssh-keygen)</li>
<li>create github user</li>
<li>add public-key to github user account</li>
<li>let the project owner add you as project member</li>
<li>git clone git@&#8230; </li>
</ol>
<p>Where 1 &lt; 3, 1 &lt; 2 &lt; 4, 2 &lt; 5 if that means anything to you ;-)</p>
<p>* it works with git remote</p>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200903/add-collaborator-to-github-repository/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Skype in Pidgin</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200902/skype-in-pidgin</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200902/skype-in-pidgin#comments</comments>
		<pubDate>Tue, 17 Feb 2009 13:49:31 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>
		<category><![CDATA[ad]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=23</guid>
		<description><![CDATA[

There is a Skype API plugin available for pidgin. Looks like this:
To compile it under 64bit Linux, do

$ svn checkout http:// skype4pidgin.googlecode.com/svn/trunk/ skype4pidgin-read-only
$ cd skype4pidgin-read-only
$ make all
$ sudo make install

Restart pidgin. You get 2 additional account types: Skype and Skype (DBUS). 
I don&#8217;t understand why the author is flamed for not making a independent protocol [...]]]></description>
			<content:encoded><![CDATA[<p><img width="126" height="300" title="" class="left" align="left" style="margin-right: 1em;" src="http://johannes.jakeapp.com/blog/oldblog/images/Screenshot-Buddy List.png" alt="Screenshot-Buddy List" />
<div>
There is a <a href="http://eion.robbmob.com/">Skype API plugin</a> available for pidgin. Looks like this:</p>
<p>To compile it under 64bit Linux, do</p>
<pre><code>
$ svn checkout http:// skype4pidgin.googlecode.com/svn/trunk/ skype4pidgin-read-only
$ cd skype4pidgin-read-only
$ make all
$ sudo make install
</code></pre>
<p>Restart pidgin. You get 2 additional account types: Skype and Skype (DBUS). </p>
<p>I don&#8217;t understand why the author is flamed for not making a independent protocol implementation that doesn&#8217;t need Skype running. It is Skype that prohibits that.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200902/skype-in-pidgin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven: Colorized</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/maven-colorized</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/maven-colorized#comments</comments>
		<pubDate>Wed, 07 Jan 2009 03:19:07 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[thisreallyworks]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=28</guid>
		<description><![CDATA[Maven was written by people who obviously have no idea on how to create good tui (Text User Interface)-tools. They should sit together with the portage, git or other Linux-devs. 
The output is unreadable (not to mention that the startup is slow). 
So, what I did was wrap maven in a script that colorizes the [...]]]></description>
			<content:encoded><![CDATA[<p>Maven was written by people who obviously have no idea on how to create good tui (Text User Interface)-tools. They should sit together with the portage, git or other Linux-devs. <br />
The output is unreadable (not to mention that the startup is slow). </p>
<p>So, what I did was wrap maven in a script that colorizes the output. The result looks like this:<br />
<img width="400" height="163" title="" src="http://johannes.jakeapp.com/blog/oldblog/images/colorizedmaven.png" alt="colorizedmaven" /></p>
<p>This is how to do it:<br />
create the file ~/bin/mvn with the following content (<a title="" href="http://johannes.jakeapp.com/blog/oldblog/files/mvn." as="link">mvn</a> (0 KB))
<pre><code>#!/bin/bash
/usr/bin/mvn $* | sed -e 's/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/[1;32mTests run: \1[0m, Failures: [1;31m\2[0m, Errors: [1;33m\3[0m, Skipped: [1;34m\4[0m/g' \
-e 's/\(\[WARN\].*\)/[1;33m\1[0m/g' \
-e 's/\(\[INFO\].*\)/[1;34m\1[0m/g' \
-e 's/\(\[ERROR\].*\)/[1;31m\1[0m/g'</code></pre>
<p>replace /usr/bin/mvn with wherever your mvn is (find out with <code>which mvn</code>).<br />
Double-check that you get the encoding right, the weird sign should be hexadecimal 1b. Use a editor that supports encodings for copy+paste.<br />
Give your ~/bin/mvn execute permissions (<code>chmod +x ~/bin/mvn</code>)</p>
<p>Try it out: call <code>~/bin/mvn</code> in one of your maven projects</p>
<p>What is left to do is to register your new mvn-wrapper so it is called everytime. <br />
Add the following line to your ~/.bashrc :
<pre><code>alias mvn=~/bin/mvn</code></pre>
<p>Execute the command you just added in your running shells so you can use it there too.</p>
<p>You are done.</p>
<p><strong>Changing the distributed mvn startup script</strong></p>
<p>Even better, but a little more intrusive (you need root rights): <br />
change the distributed mvn file. It is a bash script actually. <br />
In gentoo:</p>
<pre><code> $ which mvn
/usr/bin/mvn
$ file /usr/bin/mvn
/usr/bin/mvn: symbolic link to `/usr/share/maven-bin-2.0/bin/mvn'
$ file /usr/share/maven-bin-2.0/bin/mvn
/usr/share/maven-bin-2.0/bin/mvn: Bourne shell script text executable
$ </code></pre>
<p>Change the last call in that file to:</p>
<pre><code>exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "${M2_HOME}"/boot/classworlds-*.jar \
"-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
"-Dmaven.home=${M2_HOME}"  \
${CLASSWORLDS_LAUNCHER} $QUOTED_ARGS |
sed -e 's/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/[1;32mTests run: \1[0m, Failures: [1;31m\2[0m, Errors: [1;33m\3[0m, Skipped: [1;34m\4[0m/g' \
-e 's/\(\[WARN\].*\)/[1;33m\1[0m/g' \
-e 's/\(\[INFO\].*\)/[1;34m\1[0m/g' \
-e 's/\(\[ERROR\].*\)/[1;31m\1[0m/g'
</code></pre>
<p>That way you have it there directly. Maybe the gentoo devs could add a color use-flag. That&#8217;d be fun&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/maven-colorized/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash: Timeouts</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/bash-timeouts</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/bash-timeouts#comments</comments>
		<pubDate>Tue, 06 Jan 2009 23:36:09 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>
		<category><![CDATA[hint]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=27</guid>
		<description><![CDATA[You have a command and want to kill it after a certain time if it hasn&#8217;t finished.
This script does it for you:
timeoutwrapper.sh
#!/bin/bash
# License: BSD License
# author: Ram
# author: Johannes Buchner
TIMEOUT=$1
shift
COMMAND="$*"
if [[ "$TIMEOUT" == "" ]] &#124;&#124; [[ "$COMMAND" == "" ]]; then
echo "USAGE: $0 &#60;seconds to wait&#62; &#60;command with arguments&#62;"
exit
fi
$COMMAND &#38;
PRODPID=$!
export PRODPID
# record own PID
export [...]]]></description>
			<content:encoded><![CDATA[<p>You have a command and want to kill it after a certain time if it hasn&#8217;t finished.<br />
This script does it for you:</p>
<p>timeoutwrapper.sh
<pre name="code" class="Bash"><code>#!/bin/bash
# License: BSD License
# author: Ram
# author: Johannes Buchner
TIMEOUT=$1
shift
COMMAND="$*"
if [[ "$TIMEOUT" == "" ]] || [[ "$COMMAND" == "" ]]; then
echo "USAGE: $0 &lt;seconds to wait&gt; &lt;command with arguments&gt;"
exit
fi
$COMMAND &amp;
PRODPID=$!
export PRODPID
# record own PID
export PID=$$
# define exit function
exit_timeout() {
echo "Timeout. Checking for unfinished."
for i in ${PRODPID} ; do
ps -p $i |grep -v "PID TTY"
if [ $? == 0 ] ; then
# process still alive
echo "Sending SIGTERM to process $i"
kill $i
fi
done
# timeout exit
exit
}
# Handler for signal USR1 for the timer
trap exit_timeout SIGUSR1
# starting timer in subshell. It sends a SIGUSR1 to the father if it timeouts.
export TIMEOUT
(sleep $TIMEOUT ; kill -SIGUSR1 $PID) &amp;
# record PID of timer
TPID=$!
# wait for all production processes to finish
wait ${PRODPID}
# Normal exit
echo "All processes ended normal"
# kill timer
kill $TPID</code></pre>
<p>Usage examples:</p>
<pre><code>$ bash timeoutwrapper.sh
USAGE: timeoutwrapper.sh &lt;seconds to wait&gt; &lt;command with arguments&gt;
$ bash timeoutwrapper.sh 1 sleep 3
Timeout. Checking for unfinished.
26612 pts/3    00:00:00 sleep
Sending SIGTERM to process 26612
$ bash timeoutwrapper.sh 4 sleep 3
All processes ended normal
$ bash timeoutwrapper.sh 2 du -sh .
Timeout. Checking for unfinished.
26622 pts/3    00:00:00 du
Sending SIGTERM to process 26622
$</code></pre>
<p>
PS: I found the script here and adopted it<br />
<a href="http://redflo.de/tiki-index.php?page=Bash+script+with+timeout+function">http://redflo.de/tiki-index.php?page=Bash+script+with+timeout+function</a></p>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/bash-timeouts/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SSH -R is even cooler than -L</title>
		<link>http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/ssh-r-is-even-cooler-than-l</link>
		<comments>http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/ssh-r-is-even-cooler-than-l#comments</comments>
		<pubDate>Mon, 05 Jan 2009 18:19:51 +0000</pubDate>
		<dc:creator>JohannesTheDeveloper</dc:creator>
				<category><![CDATA[fun with Linux]]></category>
		<category><![CDATA[hint]]></category>

		<guid isPermaLink="false">http://johannes.jakeapp.com/blog/?p=30</guid>
		<description><![CDATA[To be honest with you, I thought for three years now that the -L option of ssh is a cool thing. It connects to the ssh server and offers a remote service (port) locally. Call it port tunnelling. Great against firewalls.
Anyway, consider you have a ssh server in the internet, and two computers behind different [...]]]></description>
			<content:encoded><![CDATA[<p>To be honest with you, I thought for three years now that the -L option of ssh is a cool thing. It connects to the ssh server and offers a remote service (port) locally. Call it port tunnelling. Great against firewalls.</p>
<p>Anyway, consider you have a ssh server in the internet, and two computers behind different firewalls that only let traffic out. But you want to connect from computer A to computer B. <br />
So you could connect to the ssh server from both computers, but you would need some software that reverses your TCP flow. One of the channels has to be the client and one the server. That might even be possible just using pipes and ssh -L. </p>
<p>Ok, so I thought I was clever until I found the -R option. <br />
What it does is to connects to the ssh server and offers a local service (port) remotely.  (-L offers a remote service (port) locally.) <br />
Consequent.  And works nicely too!</p>
]]></content:encoded>
			<wfw:commentRss>http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/ssh-r-is-even-cooler-than-l/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
