<?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>Tim Van Wassenhove &#187; Bash</title>
	<atom:link href="http://www.timvw.be/category/information-technology/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.timvw.be</link>
	<description>The journey of a thousand miles begins with one step.</description>
	<lastBuildDate>Thu, 29 Jul 2010 17:07:31 +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>Restore from a MySQL dumpfile</title>
		<link>http://www.timvw.be/restore-from-a-mysql-dumpfile/</link>
		<comments>http://www.timvw.be/restore-from-a-mysql-dumpfile/#comments</comments>
		<pubDate>Thu, 12 Jan 2006 00:16:52 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://www.timvw.be/restore-from-a-mysql-dumpfile/</guid>
		<description><![CDATA[If you are a longtime user of mysqldump you may have experienced that restoring with mysql &#60; dumpfile doesn&#8217;t always work because of referential problems. Here is a little script that takes care of it: mysql-restore.txt.]]></description>
			<content:encoded><![CDATA[<p>If you are a longtime user of <a href="http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html">mysqldump</a> you may have experienced that restoring with mysql &lt; dumpfile doesn&#8217;t always work because of referential problems. Here is a little script that takes care of it: <a href="http://www.timvw.be/wp-content/code/bash/mysql-restore.txt">mysql-restore.txt</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/restore-from-a-mysql-dumpfile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup script</title>
		<link>http://www.timvw.be/backup-script/</link>
		<comments>http://www.timvw.be/backup-script/#comments</comments>
		<pubDate>Sun, 27 Jun 2004 22:55:15 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://www.timvw.be/backup-script/</guid>
		<description><![CDATA[The current shell server i&#8217;m using returns bogus output for commands like df. Mind the negative value for 1-k blocks. timvw@localhost:~$ df Filesystem 1k-blocks Used Available Use% Mounted on /dev/hda1 -780429856382 1 0 74% / It thought it would be a good idea to have a backup once in a while, but most of the [...]]]></description>
			<content:encoded><![CDATA[<p>The current shell server i&#8217;m using returns bogus output for commands like df. Mind the negative value for 1-k blocks.</p>
<p>timvw@localhost:~$ df</p>
<table>
<tr>
<td>Filesystem</td>
<td>1k-blocks</td>
<td>Used</td>
<td>Available</td>
<td>Use%</td>
<td>Mounted on</td>
</tr>
<tr>
<td>/dev/hda1</td>
<td><b>-780429856382</b></td>
<td>1</td>
<td>0</td>
<td>74%</td>
<td>/</td>
</tr>
</table>
<p>It thought it would be a good idea to have a backup once in a while, but most of the times when i did it, i forgot to backup my database. So i wrote a little backup.script that remembers to do that for me.</p>
<div class="bash" style="font-family:monospace;"><span class="co0">#!/bin/bash</span><br />
<span class="co0">############################################################################### </span><br />
<span class="co0"># Generate a backup file of homedirectory and database</span><br />
<span class="co0"># Author: Tim Van Wassenhove &lt;timvw@users.sourceforge.net&gt;</span><br />
<span class="co0"># Update: 2005-09-16 01:56:00</span><br />
<span class="co0">###############################################################################</span><br />
<span class="co0"># dump database </span><br />
mysqldump <span class="re5">-u</span> username <span class="re5">-ppassword</span> <span class="re5">-h</span> invalid.org dbname <span class="sy0">&gt;</span> ~<span class="sy0">/</span>mysql.dmp<br />
<br />
<span class="co0"># generate gzipped archive of homedirectory</span><br />
<span class="kw2">tar</span> <span class="re5">-czf</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>backup.tgz ~<br />
<br />
<span class="co0"># move backup to homedirectory and change name</span><br />
<span class="kw2">mv</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>backup.tgz ~<span class="sy0">/</span>madoka-<span class="sy0">`</span><span class="kw2">date</span> +<span class="sy0">%</span>F<span class="sy0">`</span>.tgz<br />
<br />
<span class="co0"># remove database dump</span><br />
<span class="kw2">rm</span> ~<span class="sy0">/</span>mysql.dmp<br />
&nbsp;</div><p>Download the source for <a href="http://www.timvw.be/wp-content/code/bash/backup.txt">backup.txt</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/backup-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Listen to online radio</title>
		<link>http://www.timvw.be/listen-to-online-radio/</link>
		<comments>http://www.timvw.be/listen-to-online-radio/#comments</comments>
		<pubDate>Thu, 20 May 2004 22:40:28 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://www.timvw.be/listen-to-online-radio/</guid>
		<description><![CDATA[#!/bin/sh # # Author: Tim Van Wassenhove &#60;timvw@users.sourceforge.net&#62; # Update: 2004-05-21 02:50:31 # # This script allows you to listen to Belgian online radio streams. # if &#91; &#34;1&#34; == &#34;&#34; &#93;; then echo &#34; [1] &#160; Radio 1 [2] &#160; Radio 2 [3] &#160; Studio Brussel [4] &#160; Donna [5] &#160; 4FM [6] &#160; [...]]]></description>
			<content:encoded><![CDATA[<div class="bash" style="font-family:monospace;"><span class="co0">#!/bin/sh</span><br />
<span class="co0">#</span><br />
<span class="co0"># Author: Tim Van Wassenhove &lt;timvw@users.sourceforge.net&gt;</span><br />
<span class="co0"># Update: 2004-05-21 02:50:31</span><br />
<span class="co0">#</span><br />
<span class="co0"># This script allows you to listen to Belgian online radio streams.</span><br />
<span class="co0">#</span><br />
<br />
<span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;1&quot;</span> == <span class="st0">&quot;&quot;</span> <span class="br0">&#93;</span>; <span class="kw1">then</span><br />
<span class="kw3">echo</span> <span class="st0">&quot;<br />
[1] &nbsp; Radio 1<br />
[2] &nbsp; Radio 2<br />
[3] &nbsp; Studio Brussel<br />
[4] &nbsp; Donna<br />
[5] &nbsp; 4FM<br />
[6] &nbsp; QMusic<br />
[7] &nbsp; Topradio<br />
[9] &nbsp; Klara<br />
<br />
Enter your choice: &quot;</span><br />
<span class="kw2">read</span> choice <br />
<span class="kw1">else</span><br />
<span class="re2">choice</span>=<span class="st0">&quot;1&quot;</span><br />
<span class="kw1">fi</span><br />
<br />
<span class="kw1">case</span> <span class="st0">&quot;<span class="es2">$choice</span>&quot;</span> <span class="kw1">in</span><br />
&nbsp; &nbsp; <span class="nu0">1</span><span class="br0">&#41;</span> <span class="re2">station</span>=<span class="st0">&quot;mms://streampower.belgacom.be:1755/radio1high&quot;</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="nu0">2</span><span class="br0">&#41;</span> <span class="re2">station</span>=<span class="st0">&quot;mms://streampower.belgacom.be:1755/ra2vlbhigh&quot;</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="nu0">3</span><span class="br0">&#41;</span> <span class="re2">station</span>=<span class="st0">&quot;mms://streampower.belgacom.be:1755/stubruhigh&quot;</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="nu0">4</span><span class="br0">&#41;</span> <span class="re2">station</span>=<span class="st0">&quot;mms://streampower.belgacom.be:1755/donnahigh&quot;</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="nu0">5</span><span class="br0">&#41;</span> <span class="re2">station</span>=<span class="st0">&quot;mms://mss.streampower.be/4fmhi&quot;</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="nu0">6</span><span class="br0">&#41;</span> <span class="re2">station</span>=<span class="st0">&quot;mms://mss.streampower.be/qmusic_ahi&quot;</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="nu0">7</span><span class="br0">&#41;</span> <span class="re2">station</span>=<span class="st0">&quot;mms://mss.streampower.be/topahi&quot;</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="nu0">9</span><span class="br0">&#41;</span> <span class="re2">station</span>=<span class="st0">&quot;mms://streampower.belgacom.be:1755/stubruhigh&quot;</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="sy0">*</span><span class="br0">&#41;</span> <span class="kw3">echo</span> <span class="st0">&quot;Wrong choice!&quot;</span><br />
&nbsp; &nbsp; <span class="kw3">exit</span><br />
<span class="kw1">esac</span><br />
<br />
<span class="kw2">mplayer</span> <span class="re1">$station</span><br />
<br />
<span class="kw3">exit</span><br />
&nbsp;</div><p>Download the source for <a href="http://www.timvw.be/wp-content/code/bash/radio.txt">radio.txt</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/listen-to-online-radio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kill a user and his processes</title>
		<link>http://www.timvw.be/kill-a-user-and-his-processes/</link>
		<comments>http://www.timvw.be/kill-a-user-and-his-processes/#comments</comments>
		<pubDate>Thu, 11 Dec 2003 22:37:06 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://www.timvw.be/kill-a-user-and-his-processes/</guid>
		<description><![CDATA[#!/bin/sh # # Author: Tim Van Wassenhove # Update: 12-12-2003 13:15 # # This script kills all processes that are owned by a given user. # if &#91; -n &#34;1&#34; &#93; then &#160; &#160; &#160; &#160; ps -ef &#124; grep $1 &#124; grep -v grep &#124; awk &#8216;{ print }&#8217; &#124; xargs kill -9 else [...]]]></description>
			<content:encoded><![CDATA[<div class="bash" style="font-family:monospace;"><span class="co0">#!/bin/sh</span><br />
<span class="co0">#</span><br />
<span class="co0"># Author: Tim Van Wassenhove</span><br />
<span class="co0"># Update: 12-12-2003 13:15</span><br />
<span class="co0">#</span><br />
<span class="co0"># This script kills all processes that are owned by a given user.</span><br />
<span class="co0">#</span><br />
<br />
<span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-n</span> <span class="st0">&quot;1&quot;</span> <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">ps</span> <span class="re5">-ef</span> <span class="sy0">|</span> <span class="kw2">grep</span> $<span class="nu0">1</span> <span class="sy0">|</span> <span class="kw2">grep</span> <span class="re5">-v</span> <span class="kw2">grep</span> <span class="sy0">|</span> <span class="kw2">awk</span> <span class="st_h">&#8216;{ print  }&#8217;</span> <span class="sy0">|</span> <span class="kw2">xargs</span> <span class="kw2">kill</span> <span class="re5">-9</span><br />
<span class="kw1">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">echo</span> <span class="st0">&quot;Usage: killuser.sh username&quot;</span><br />
<span class="kw1">fi</span> <br />
&nbsp;</div><p>Download the source for <a href="http://www.timvw.be/wp-content/code/bash/killuser.txt">killuser.txt</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/kill-a-user-and-his-processes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
