<?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>cat brain.stuff &#62; wordpress &#187; Linux</title>
	<atom:link href="http://famvdploeg.com/blog/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://famvdploeg.com/blog</link>
	<description>A simple look on things</description>
	<lastBuildDate>Wed, 21 Mar 2012 19:47:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>VLC Radiostation Bash script</title>
		<link>http://famvdploeg.com/blog/2011/10/vlc-radiostation-bash-script/</link>
		<comments>http://famvdploeg.com/blog/2011/10/vlc-radiostation-bash-script/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 14:30:10 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[vlc]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=249</guid>
		<description><![CDATA[We use the following script to have our linux machine automatically start playing audio at startup. Every day another radio station will be played with a random choice for some days. It could use some functions to make it a bit tidier, but I&#8217;m satisfied with it at this point. #!/bin/bash &#160; # Arrow Classic [...]]]></description>
			<content:encoded><![CDATA[<p>We use the following script to have our linux machine automatically start playing audio at startup. Every day another radio station will be played with a random choice for some days. It could use some functions to make it a bit tidier, but I&#8217;m satisfied with it at this point. <img src='http://famvdploeg.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Arrow Classic Rock</span>
radio_stations<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=http:<span style="color: #000000; font-weight: bold;">//</span>www.garnierstreamingmedia.com<span style="color: #000000; font-weight: bold;">/</span>asx<span style="color: #000000; font-weight: bold;">/</span>streamerswitch.asp?<span style="color: #007800;">stream</span>=<span style="color: #000000;">205</span>
<span style="color: #666666; font-style: italic;"># City FM</span>
radio_stations<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=http:<span style="color: #000000; font-weight: bold;">//</span>streams.cityfm.nl:<span style="color: #000000;">8043</span><span style="color: #000000; font-weight: bold;">/</span>listen.pls
<span style="color: #666666; font-style: italic;"># QMusic</span>
radio_stations<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=http:<span style="color: #000000; font-weight: bold;">//</span>vip2.str.reasonnet.com<span style="color: #000000; font-weight: bold;">/</span>qmusic.mp3.96
<span style="color: #666666; font-style: italic;"># Eagle FM</span>
radio_stations<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=http:<span style="color: #000000; font-weight: bold;">//</span>www.181.fm<span style="color: #000000; font-weight: bold;">/</span>asx.php?<span style="color: #007800;">station</span>=<span style="color: #000000;">181</span>-eagle
&nbsp;
<span style="color: #666666; font-style: italic;">#current day of week, 0 is sunday</span>
<span style="color: #007800;">curr_day_of_week</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span><span style="color: #c20cb9; font-weight: bold;">w</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$curr_day_of_week</span> <span style="color: #000000; font-weight: bold;">in</span>
        <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #007800;">number</span>=<span style="color: #007800;">$RANDOM</span>
                <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;number %= <span style="color: #007800;">${#radio_stations[@]}</span>&quot;</span>
                <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>vlc <span style="color: #800000;">${radio_stations[$number]}</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>vlc <span style="color: #800000;">${radio_stations[0]}</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>vlc <span style="color: #800000;">${radio_stations[1]}</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>vlc <span style="color: #800000;">${radio_stations[2]}</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>vlc <span style="color: #800000;">${radio_stations[3]}</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #007800;">number</span>=<span style="color: #007800;">$RANDOM</span>
                <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;number %= <span style="color: #007800;">${#radio_stations[@]}</span>&quot;</span>
                <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>vlc <span style="color: #800000;">${radio_stations[$number]}</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #007800;">number</span>=<span style="color: #007800;">$RANDOM</span>
                <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;number %= <span style="color: #007800;">${#radio_stations[@]}</span>&quot;</span>
                <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>vlc <span style="color: #800000;">${radio_stations[$number]}</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2011/10/vlc-radiostation-bash-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.181.fm/asx.php?station=181-eagle" length="0" type="video/x-ms-asf" />
<enclosure url="http://www.garnierstreamingmedia.com/asx/streamerswitch.asp?stream=205" length="205" type="video/x-ms-asf" />
		</item>
		<item>
		<title>Basic iptables configuration</title>
		<link>http://famvdploeg.com/blog/2010/01/basic-iptables-configuration/</link>
		<comments>http://famvdploeg.com/blog/2010/01/basic-iptables-configuration/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 13:21:36 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux iptables chains]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=136</guid>
		<description><![CDATA[Here is a small basic example allowing you to setup your iptables. First we reset everything. See the man page for exact details on the parameters we use. iptables -F iptables -Z iptables -X Create some chains that will provide us with some logging. iptables -N logdrop iptables -N logreject iptables -N logaccept Add some [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a small basic example allowing you to setup your iptables.</p>
<p>First we reset everything. See the man page for exact details on the parameters we use.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-F</span>
iptables <span style="color: #660033;">-Z</span>
iptables <span style="color: #660033;">-X</span></pre></div></div>

<p>Create some chains that will provide us with some logging.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-N</span> logdrop
iptables <span style="color: #660033;">-N</span> logreject
iptables <span style="color: #660033;">-N</span> logaccept</pre></div></div>

<p>Add some rules to these chains.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-A</span> logdrop <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">'DROP: '</span> <span style="color: #660033;">--log-level</span> warning
iptables <span style="color: #660033;">-A</span> logdrop <span style="color: #660033;">-j</span> DROP
iptables <span style="color: #660033;">-A</span> logreject <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">'REJECT: '</span> <span style="color: #660033;">--log-level</span> warning
iptables <span style="color: #660033;">-A</span> logreject <span style="color: #660033;">-j</span> REJECT
iptables <span style="color: #660033;">-A</span> logaccept <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">'ACCEPT: '</span> <span style="color: #660033;">--log-level</span> warning
iptables <span style="color: #660033;">-A</span> logaccept <span style="color: #660033;">-j</span> ACCEPT</pre></div></div>

<p>Now you have a basic setup with some logging.<br />
The next step will be to apply your rules and jump to the corresponding chain on a positive match.<br />
You could set the default policies for the INPUT, FORWARD and OUTPUT chains to ACCEPT and add a jump to logdrop at the end of each chain so that any non-matching rules will be automatically dropped.</p>
<p>Small example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> lo <span style="color: #660033;">-j</span> ACCEPT
iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> RELATED,ESTABLISHED <span style="color: #660033;">-j</span> ACCEPT
iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-m</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">22</span> <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> NEW <span style="color: #660033;">-j</span> logaccept
iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-m</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">443</span> <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> NEW <span style="color: #660033;">-j</span> logaccept
iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-m</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">80</span> <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> NEW <span style="color: #660033;">-j</span> logaccept
iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-j</span> logdrop
&nbsp;
iptables <span style="color: #660033;">-A</span> FORWARD <span style="color: #660033;">-j</span> logreject</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2010/01/basic-iptables-configuration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Some bash stuff</title>
		<link>http://famvdploeg.com/blog/2009/08/some-bash-stuff/</link>
		<comments>http://famvdploeg.com/blog/2009/08/some-bash-stuff/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 07:38:25 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=124</guid>
		<description><![CDATA[I just need a cheat sheet because I keep forgetting all these bash things. Number of parameters: $# All parameters: $@ String length: ${#foo} Remove trailing slash: ${foo%/} Check return value from last command: $?]]></description>
			<content:encoded><![CDATA[<p>I just need a cheat sheet because I keep forgetting all these bash things.</p>
<table border="0">
<tbody>
<tr>
<td>Number of parameters:</td>
<td>$#</td>
</tr>
<tr>
<td>All parameters:</td>
<td>$@</td>
</tr>
<tr>
<td>String length:</td>
<td>${#foo}</td>
</tr>
<tr>
<td>Remove trailing slash:</td>
<td>${foo%/}</td>
</tr>
<tr>
<td>Check return value from last command:</td>
<td>$?</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2009/08/some-bash-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>lm-sensors on the VIA EPIA SN10000EG and SN18000g</title>
		<link>http://famvdploeg.com/blog/2009/07/lm-sensors-on-the-via-epia-sn10000eg-and-sn18000g/</link>
		<comments>http://famvdploeg.com/blog/2009/07/lm-sensors-on-the-via-epia-sn10000eg-and-sn18000g/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 09:39:17 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=112</guid>
		<description><![CDATA[1. Edit /etc/modprobe.d/options.conf 2. Add the following line: options dme1737 probe_all_addr=1 3. Save and exit 4. Load the module modprobe dme1737 5. Check that it loaded succesfully: lsmod 6. Edit the /etc/sysconfig/lm_sensors file HWMON_MODULES=&#34;dme1737&#34; MODULE_0=dme1737 7. Run sensors to check the output sensors 8. I also compiled the c7temp module because the in0 didn&#8217;t show [...]]]></description>
			<content:encoded><![CDATA[<p>1. Edit /etc/modprobe.d/options.conf<br />
2. Add the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">options dme1737 <span style="color: #007800;">probe_all_addr</span>=<span style="color: #000000;">1</span></pre></div></div>

<p>3. Save and exit<br />
4. Load the module</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">modprobe dme1737</pre></div></div>

<p>5. Check that it loaded succesfully:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">lsmod</span></pre></div></div>

<p>6. Edit the /etc/sysconfig/lm_sensors file</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">HWMON_MODULES</span>=<span style="color: #ff0000;">&quot;dme1737&quot;</span>
<span style="color: #007800;">MODULE_0</span>=dme1737</pre></div></div>

<p>7. Run sensors to check the output</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">sensors</pre></div></div>

<p>8. I also compiled the c7temp module because the in0 didn&#8217;t show and loaded it.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>c7temp
<span style="color: #7a0874; font-weight: bold;">&#40;</span>I extracted the c7temp.c <span style="color: #c20cb9; font-weight: bold;">file</span> from the <span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #c20cb9; font-weight: bold;">which</span> is placed here:
http:<span style="color: #000000; font-weight: bold;">//</span>lists.lm-sensors.org<span style="color: #000000; font-weight: bold;">/</span>pipermail<span style="color: #000000; font-weight: bold;">/</span>lm-sensors<span style="color: #000000; font-weight: bold;">/</span>attachments<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20080619</span><span style="color: #000000; font-weight: bold;">/</span>0dccdaf0<span style="color: #000000; font-weight: bold;">/</span>attachment.bin<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>c7temp<span style="color: #000000; font-weight: bold;">/</span>c7temp.c
filled the contents of c7temp.c with those of the <span style="color: #c20cb9; font-weight: bold;">patch</span></pre></div></div>

<p>Created a makefile in the c7temp dir.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">obj-m    := c7temp.o
&nbsp;
KDIR    := <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span>shell <span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>build
PWD    := $<span style="color: #7a0874; font-weight: bold;">&#40;</span>shell <span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
default:
	$<span style="color: #7a0874; font-weight: bold;">&#40;</span>MAKE<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #660033;">-C</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>KDIR<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">SUBDIRS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>PWD<span style="color: #7a0874; font-weight: bold;">&#41;</span> modules</pre></div></div>

<p>And ran make in the c7temp dir. This will get you a .ko file. Install it.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">-m</span> <span style="color: #000000;">644</span> c7temp.ko <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #000000; font-weight: bold;">`/</span>kernel<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>hwmon<span style="color: #000000; font-weight: bold;">/</span>c7temp.ko</pre></div></div>

<p>Generate the modules.dep and map files</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">depmod</span> <span style="color: #660033;">-a</span></pre></div></div>

<p>And load the module</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">modprobe c7temp</pre></div></div>

<p>And check that the module loaded with lsmod</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">lsmod</span></pre></div></div>

<p>Modified the /etc/sysconfig/lm_sensors file a bit again</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Generated by sensors-detect on Wed Jul  1 08:43:13 2009</span>
<span style="color: #666666; font-style: italic;"># This file is sourced by /etc/init.d/lm_sensors and defines the modules to</span>
<span style="color: #666666; font-style: italic;"># be loaded/unloaded.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># The format of this file is a shell script that simply defines variables:</span>
<span style="color: #666666; font-style: italic;"># HWMON_MODULES for hardware monitoring driver modules, and optionally</span>
<span style="color: #666666; font-style: italic;"># BUS_MODULES for any required bus driver module (for example for I2C or SPI).</span>
&nbsp;
<span style="color: #007800;">HWMON_MODULES</span>=<span style="color: #ff0000;">&quot;dme1737 c7temp&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># For compatibility reasons, modules are also listed individually as variables</span>
<span style="color: #666666; font-style: italic;">#    MODULE_0, MODULE_1, MODULE_2, etc.</span>
<span style="color: #666666; font-style: italic;"># You should use BUS_MODULES and HWMON_MODULES instead if possible.</span>
&nbsp;
<span style="color: #007800;">MODULE_0</span>=dme1737
<span style="color: #007800;">MODULE_1</span>=c7temp</pre></div></div>

<p>Done.<br />
9. I edited the /etc/sensors3.conf file on my machine</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">chip <span style="color: #ff0000;">&quot;sch311x-*&quot;</span>
    ignore in0
&nbsp;
    label in1 <span style="color: #ff0000;">&quot;Vcore&quot;</span>
    label in2 <span style="color: #ff0000;">&quot;+3.3V&quot;</span>
    label in3 <span style="color: #ff0000;">&quot;+5V&quot;</span>
    label in4 <span style="color: #ff0000;">&quot;+12V&quot;</span>
    label in5 <span style="color: #ff0000;">&quot;3VSB&quot;</span>
    label in6 <span style="color: #ff0000;">&quot;Vbat&quot;</span>
&nbsp;
    label temp1 <span style="color: #ff0000;">&quot;CPU&quot;</span>
    label temp2 <span style="color: #ff0000;">&quot;SIO Temp&quot;</span>
    label temp3 <span style="color: #ff0000;">&quot;M/B Temp&quot;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">set</span> in2_min  <span style="color: #000000;">3.3</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">0.90</span>
    <span style="color: #000000; font-weight: bold;">set</span> in2_max  <span style="color: #000000;">3.3</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1.10</span>
    <span style="color: #000000; font-weight: bold;">set</span> in3_min  <span style="color: #000000;">5.0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">0.90</span>
    <span style="color: #000000; font-weight: bold;">set</span> in3_max  <span style="color: #000000;">5.0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1.10</span>
    <span style="color: #000000; font-weight: bold;">set</span> in4_min <span style="color: #000000;">12.0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">0.90</span>
    <span style="color: #000000; font-weight: bold;">set</span> in4_max <span style="color: #000000;">12.0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1.10</span>
    <span style="color: #000000; font-weight: bold;">set</span> in5_min  <span style="color: #000000;">3.3</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">0.90</span>
    <span style="color: #000000; font-weight: bold;">set</span> in5_max  <span style="color: #000000;">3.3</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1.10</span>
    <span style="color: #000000; font-weight: bold;">set</span> in6_min  <span style="color: #000000;">3.0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">0.90</span>
    <span style="color: #000000; font-weight: bold;">set</span> in6_max  <span style="color: #000000;">3.0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1.10</span>
&nbsp;
chip <span style="color: #ff0000;">&quot;c7temp-*&quot;</span>
    ignore temp1</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2009/07/lm-sensors-on-the-via-epia-sn10000eg-and-sn18000g/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Samba basic config</title>
		<link>http://famvdploeg.com/blog/2009/05/samba-basic-config/</link>
		<comments>http://famvdploeg.com/blog/2009/05/samba-basic-config/#comments</comments>
		<pubDate>Thu, 07 May 2009 07:10:45 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=100</guid>
		<description><![CDATA[Step one: You will need samba apt-get install samba Step two: Check if you have a group for your samba users. cat /etc/group &#124; grep samba On my system this resulted in &#8220;sambashare:x:107:&#8221; which means we have a group called sambashare with gid 107. If you don&#8217;t have a group you can create it. I [...]]]></description>
			<content:encoded><![CDATA[<p>Step one: You will need samba
<pre>apt-get install samba</pre>
<p>Step two: Check if you have a group for your samba users.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>group <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> samba</pre></div></div>

<p>On my system this resulted in &#8220;sambashare:x:107:&#8221; which means we have a group called sambashare with gid 107.</p>
<p>If you don&#8217;t have a group you can create it. I recommend specifying an own gid which you can use on multiple systems.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">groupadd <span style="color: #660033;">-g</span> <span style="color: #000000;">2000</span> share</pre></div></div>

<p>Step three: Create some basic users.</p>
<p>If the user doesn&#8217;t exist on the system you will need to create it. I assume this new user will only be used with samba.<br />
So we will force it into the sambashare group and disable the shell. (If you didn&#8217;t have the sambashare group use share or whatever name you choose in the previous step)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">useradd <span style="color: #660033;">-g</span> sambashare <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> yourusername</pre></div></div>

<p>-g sets the main group for this user<br />
-s sets the shell login</p>
<p>After this we set a samba password</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">smbpasswd <span style="color: #660033;">-a</span> yourusername</pre></div></div>

<p>-a adds a new user and sets the password</p>
<p>Do a round trip of this step for all the users you need.</p>
<p>Step four:</p>
<p>Create some basic shares. Here is a short snippet to make a new share. Edit /etc/samba/smb.conf and add something like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>sharename<span style="color: #7a0874; font-weight: bold;">&#93;</span>
valid <span style="color: #c20cb9; font-weight: bold;">users</span> = user1, user2
path = <span style="color: #000000; font-weight: bold;">/</span>share
browsable = <span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #c20cb9; font-weight: bold;">write</span> list = user2
create mask = 0664
directory mask = 0775
force user = root
force group = sambashare</pre></div></div>

<p>That&#8217;s it. Save it and then restart the server to be sure the settings are picked up.<br />
/etc/init.d/samba restart</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2009/05/samba-basic-config/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update-alternatives</title>
		<link>http://famvdploeg.com/blog/2009/03/update-alternatives/</link>
		<comments>http://famvdploeg.com/blog/2009/03/update-alternatives/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 13:08:10 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[java config update-alternatives]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=91</guid>
		<description><![CDATA[Having multiple jvm&#8217;s on your linux machine can be a pain in the ass. To select which jvm to use you can use the update-alternatives command. A small example of how to add a jvm to the alternatives here: update-alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_11/bin/java 16011 This will add an entry for your jdk into the [...]]]></description>
			<content:encoded><![CDATA[<p>Having multiple jvm&#8217;s on your linux machine can be a pain in the ass. To select which jvm to use you can use the update-alternatives command. A small example of how to add a jvm to the alternatives here:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">update-alternatives <span style="color: #660033;">--install</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java java <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>jdk1.6.0_11<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java <span style="color: #000000;">16011</span></pre></div></div>

<p>This will add an entry for your jdk into the alternatives. The last number assigns the priority to this alternative. Which is the version and build number of the relase.</p>
<p>After adding you can use the following command to select the java version you want to use:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">update-alternatives <span style="color: #660033;">--config</span> java</pre></div></div>

<p>If you switch the java update-alternatives to auto it will automatically pick the java alternative with the highest priority.</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2009/03/update-alternatives/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Time synchronization on your debian machine</title>
		<link>http://famvdploeg.com/blog/2008/08/time-synchronization-on-your-debian-machine/</link>
		<comments>http://famvdploeg.com/blog/2008/08/time-synchronization-on-your-debian-machine/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 11:50:16 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[ntp date time synchronize synchronization debian]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=86</guid>
		<description><![CDATA[In order to synchronize the time on your debian machine you can use ntp. (apt-get install ntp) This will install ntp and the ntp daemon. Edit your configuration found in /etc/ntp.conf and add some ntp servers close to your current location. I added some ntp servers for the Netherlands. # pool.ntp.org maps to more than [...]]]></description>
			<content:encoded><![CDATA[<p>In order to synchronize the time on your debian machine you can use ntp. (apt-get install ntp) This will install ntp and the ntp daemon. Edit your configuration found in /etc/ntp.conf and add some ntp servers close to your current location.</p>
<p>I added some ntp servers for the Netherlands.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># pool.ntp.org maps to more than 300 low-stratum NTP servers.</span>
<span style="color: #666666; font-style: italic;"># Your server will pick a different set every time it starts up.</span>
<span style="color: #666666; font-style: italic;">#  *** Please consider joining the pool! ***</span>
<span style="color: #666666; font-style: italic;">#  *** &lt;http://www.pool.ntp.org/join.html&gt; ***</span>
server <span style="color: #000000;">0</span>.nl.pool.ntp.org
server <span style="color: #000000;">1</span>.nl.pool.ntp.org
server <span style="color: #000000;">2</span>.nl.pool.ntp.org
server <span style="color: #000000;">3</span>.nl.pool.ntp.org
<span style="color: #666666; font-style: italic;"># server 0.debian.pool.ntp.org iburst</span>
<span style="color: #666666; font-style: italic;"># server 1.debian.pool.ntp.org iburst</span>
<span style="color: #666666; font-style: italic;"># server 2.debian.pool.ntp.org iburst</span>
<span style="color: #666666; font-style: italic;"># server 3.debian.pool.ntp.org iburst</span></pre></div></div>

<p>Test afterwards by calling the ntptime command (run as root). It should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ntp_gettime<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> returns code <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>OK<span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">time</span> cc5e6a21.5f5d5000  Tue, Aug <span style="color: #000000;">26</span> <span style="color: #000000;">2008</span> <span style="color: #000000;">13</span>:<span style="color: #000000;">40</span>:<span style="color: #000000;">17.372</span>, <span style="color: #7a0874; font-weight: bold;">&#40;</span>.372518<span style="color: #7a0874; font-weight: bold;">&#41;</span>,
  maximum error <span style="color: #000000;">1299815</span> us, estimated error <span style="color: #000000;">646</span> us
ntp_adjtime<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> returns code <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>OK<span style="color: #7a0874; font-weight: bold;">&#41;</span>
  modes 0x0 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>,
  offset -<span style="color: #000000;">141.000</span> us, frequency -<span style="color: #000000;">36.781</span> ppm, interval <span style="color: #000000;">1</span> s,
  maximum error <span style="color: #000000;">1299815</span> us, estimated error <span style="color: #000000;">646</span> us,
  status 0x1 <span style="color: #7a0874; font-weight: bold;">&#40;</span>PLL<span style="color: #7a0874; font-weight: bold;">&#41;</span>,
  <span style="color: #000000; font-weight: bold;">time</span> constant <span style="color: #000000;">6</span>, precision <span style="color: #000000;">1.000</span> us, tolerance <span style="color: #000000;">512</span> ppm,</pre></div></div>

<p>You can verify that your system clock was set ok now by calling the date command.</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2008/08/time-synchronization-on-your-debian-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Trac with MySQL database</title>
		<link>http://famvdploeg.com/blog/2008/08/installing-trac-with-mysql-database/</link>
		<comments>http://famvdploeg.com/blog/2008/08/installing-trac-with-mysql-database/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 19:15:07 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[trac mysql install guide tutorial]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=68</guid>
		<description><![CDATA[1. Follow the basic guide posted here. 2. Be sure to install python-mysqldb package. 3. Create MySQL database and user for trac. CREATE DATABASE trac; CREATE USER trac IDENTIFIED BY 'trac'; GRANT ALL privileges ON trac.* TO 'trac'@'%'; 4. Run the following command: trac-admin &#60;Your project dir&#62; initenv 5. When asked for the MySQL connection [...]]]></description>
			<content:encoded><![CDATA[<p>1. Follow the basic guide posted <a title="Trac on Debian" href="http://trac.edgewall.org/wiki/TracOnDebian" target="_blank">here</a>.<br />
2. Be sure to install python-mysqldb package.<br />
3. Create MySQL database and user for trac.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> trac;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">USER</span> trac <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'trac'</span>;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">ALL</span> privileges <span style="color: #993333; font-weight: bold;">ON</span> trac<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'trac'</span>@<span style="color: #ff0000;">'%'</span>;</pre></div></div>

<p>4. Run the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">trac-admin <span style="color: #000000; font-weight: bold;">&lt;</span>Your project <span style="color: #c20cb9; font-weight: bold;">dir</span><span style="color: #000000; font-weight: bold;">&gt;</span> initenv</pre></div></div>

<p>5. When asked for the MySQL connection url enter something like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#form: db-type://username:password@mysql-host:mysql-port/databasename</span>
mysql:<span style="color: #000000; font-weight: bold;">//</span>trac:trac<span style="color: #000000; font-weight: bold;">@</span>localhost:<span style="color: #000000;">3306</span><span style="color: #000000; font-weight: bold;">/</span>trac</pre></div></div>

<p>6. Configuring Apache2 (Make sure you have mod_python)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">        <span style="color: #000000; font-weight: bold;">&lt;</span>Location <span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span><span style="color: #000000; font-weight: bold;">&gt;</span>
                SetHandler mod_python
                PythonInterpreter main_interpreter
                PythonHandler trac.web.modpython_frontend
                PythonOption TracEnv <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span>
                PythonOption TracUriRoot <span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span>
        <span style="color: #000000; font-weight: bold;">&lt;/</span>Location<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">&lt;</span>LocationMatch <span style="color: #ff0000;">&quot;/trac/[^/]+/login&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
                AuthType Basic
                AuthName <span style="color: #ff0000;">&quot;Trac&quot;</span>
                AuthUserFile <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/</span>trac.htpasswd
                Require valid-user
        <span style="color: #000000; font-weight: bold;">&lt;/</span>LocationMatch<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>7. Add admin login data</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">htpasswd <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/</span>trac.htpasswd admin</pre></div></div>

<p>8. Grant TRAC_ADMIN to admin user</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">trac-admin <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span> permission add admin TRAC_ADMIN</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2008/08/installing-trac-with-mysql-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Debian modifying permissions for files or directories</title>
		<link>http://famvdploeg.com/blog/2008/07/debian-modifying-permissions-for-files-or-directories/</link>
		<comments>http://famvdploeg.com/blog/2008/07/debian-modifying-permissions-for-files-or-directories/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 09:44:41 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[linux debian find xargs chmod]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=42</guid>
		<description><![CDATA[Sometimes you want to change specific settings to either files or directories on your debian machine. To be able to do this I use the find command combined with the xargs command. Have a look at some possible commands: find /share/ -type f -print0 &#124; xargs -0 chmod 664 find /share/ -type d -print0 &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you want to change specific settings to either files or directories on your debian machine. To be able to do this I use the find command combined with the xargs command. Have a look at some possible commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-print0</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">664</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-print0</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">775</span></pre></div></div>

<p>The first line tries to find files only with -type f. And prints them to the stream with -print0 so xargs can process them with the -0 command. -print0 will put a NUL value between pathnames. This way paths that contain spaces can be parsed correctly by xargs.<br />
I think it is pretty nifty and once again shows the power of the console!</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2008/07/debian-modifying-permissions-for-files-or-directories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Putting /var in ram</title>
		<link>http://famvdploeg.com/blog/2008/03/putting-var-in-ram/</link>
		<comments>http://famvdploeg.com/blog/2008/03/putting-var-in-ram/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 10:46:58 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[debian ramdisk synching rsync sync logfile flash flashd]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=40</guid>
		<description><![CDATA[Well there you have it. I wanted to save some more power on my debian server. So I installed a flash disk and copied my debian install from hd to it. After that I made my hd spin down automatically by using hdparm. At the moment flash-memory is limited to ~10.000 write/erase cycles. By spreading [...]]]></description>
			<content:encoded><![CDATA[<p>Well there you have it. I wanted to save some more power on my debian server. So I installed a flash disk and copied my debian install from hd to it.</p>
<p>After that I made my hd spin down automatically by using hdparm.</p>
<p>At the moment flash-memory is limited to ~10.000 write/erase cycles. By spreading the writes to disk the manufacturers try to avoid this problem. With a 24/7 server writing regularly to log files this might become a problem on the long run. That&#8217;s why I decided to put /var completely into memory by using a ramdisk. Note that you should not do/use this when you are running enterprise critical applications where a system crash might result in serious data loss.</p>
<p>First things first. First create a directory where we will persist our /var directory to in case of shutdown/reboot. I created a directory var-bak for this.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var-bak</pre></div></div>

<p>I then copied the /var directory to this /var-bak directory with cp -a.<br />
After that I removed the /var-bak/run directory which should not be stored.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>var-bak<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">/</span>var-bak<span style="color: #000000; font-weight: bold;">/</span>run</pre></div></div>

<p>Ok, so now we have a copy of our contents in /var. Let&#8217;s mount the ramdisk. And copy the contents of /var-bak back to the ramdisk.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-t</span> ramfs ramfs <span style="color: #000000; font-weight: bold;">/</span>var
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">/</span>var-bak<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Ok there we have it. It&#8217;s all set up now. Using this method might cause some trouble. Try a df command to see what I mean.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">router:~<span style="color: #666666; font-style: italic;"># df -h /var</span>
Filesystem            Size  Used Avail Use<span style="color: #000000; font-weight: bold;">%</span> Mounted on
ramfs                    <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>   -  <span style="color: #000000; font-weight: bold;">/</span>var</pre></div></div>

<p>That&#8217;s right it lists 0 as available space. Programs which perform space checks might report an &#8216;insufficient diskpace&#8217; error. I had to fix the mysql init script to ignore this.</p>
<p>To be able to copy and synch the disks automatically on startup/shutdown/reboot I created a init script.<br />
I called it ramdisk.sh and placed it in the /etc/init.d directory.</p>
<p>RSync makes sure the /var-bak directory keeps correctly synched with the /var directory. Also it makes sure the run directory is ignored during the synch process.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /bin/sh</span>
<span style="color: #666666; font-style: italic;"># /etc/init.d/ramdisk.sh</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
  start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Copying files to Ramdisk&quot;</span>
    <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">/</span>var-bak<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%Y-%m-%d %H:%M&quot;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Ramdisk Synched from HD <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>ramdisk_sync.log
    <span style="color: #000000; font-weight: bold;">;;</span>
  <span style="color: #c20cb9; font-weight: bold;">sync</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Synching files to Harddisk&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%Y-%m-%d %H:%M&quot;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Ramdisk Synched to HD <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>ramdisk_sync.log
    rsync <span style="color: #660033;">-av</span> <span style="color: #660033;">--delete</span> <span style="color: #660033;">--exclude</span>=run<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">--exclude</span>=run<span style="color: #000000; font-weight: bold;">/**</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>var-bak<span style="color: #000000; font-weight: bold;">/</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
  stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Synching logfiles to Harddisk&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%Y-%m-%d %H:%M&quot;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Ramdisk Synched to HD <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>ramdisk_sync.log
    rsync <span style="color: #660033;">-av</span> <span style="color: #660033;">--delete</span> <span style="color: #660033;">--exclude</span>=run<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">--exclude</span>=run<span style="color: #000000; font-weight: bold;">/**</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>var-bak<span style="color: #000000; font-weight: bold;">/</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
  <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: /etc/init.d/ramdisk.sh {start|stop|sync}&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>After that I wanted it to be started as early as possible. So I placed it as early in the process as possible.<br />
Maybe this still needs some more tweaking but this works ok for me at this point. You can use the sync command to manually sync the ramdisk to disk.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">update-rc.d ramdisk.sh defaults 00 <span style="color: #000000;">99</span></pre></div></div>

<p>That&#8217;s it. You could optionally run a cron job to synch the ramdisk every once in a while if you like. It will at least save quite some write cycles.</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2008/03/putting-var-in-ram/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

