<?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>Fritz Thomas &#187; bash</title>
	<atom:link href="http://fritzthomas.com/tags/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://fritzthomas.com</link>
	<description></description>
	<lastBuildDate>Fri, 23 Jul 2010 08:02:28 +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>How to recursive set different permissions on directories and files</title>
		<link>http://fritzthomas.com/open-source/linux/546-how-to-recursive-set-different-permissions-on-directories-and-files/</link>
		<comments>http://fritzthomas.com/open-source/linux/546-how-to-recursive-set-different-permissions-on-directories-and-files/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 14:04:56 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://fritzthomas.com/?p=546</guid>
		<description><![CDATA[Have you ever wanted to set permission to all directories under a certain directory to 755 and permissions to files under that certain path to 644? D=/home/user/certain/directory/;find &#34;$D&#34; -type f -exec chmod 0644 &#123;&#125; \; &#38;&#38; find &#34;$D&#34; -type d -exec chmod 0755 &#123;&#125; \; This will change all files under &#8220;/home/user/certain/directory/&#8221; to 644 and [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to set permission to all directories under a certain directory to 755 and permissions to files under that certain path to 644?</p>
<p><span id="more-546"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">D</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>user<span style="color: #000000; font-weight: bold;">/</span>certain<span style="color: #000000; font-weight: bold;">/</span>directory<span style="color: #000000; font-weight: bold;">/</span>;<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$D</span>&quot;</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> 0644 <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \; <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$D</span>&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> 0755 <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>

<p><div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p>This will change all files under &#8220;/home/user/certain/directory/&#8221; to 644 and all directories to 755. The permission of the directory itself gets not changed. you have to do that manually.</p>
<p><code>find "$D"</code> searches under that given directory. <code>$D</code> is a variable reference to the path. We did this that way so you have to change the path only once. You could also use <code>find "/home/user/certain/directory/"</code> which is the same.<br />
<code>-type d</code> returns all directorys and <code>-type f</code> returns all files under the given directory.<br />
The last important parameter to find is <code>-exec</code>. It EXECutes the given command after <code>-exec</code>. In our case we want to execute chmod. To substitute the path for each single founding you have to use the two braces <code>{}</code>. With <code>\;</code> you tell find that the command ends here.
</p>
<p><div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p>Thats it. I hope that helped you.</p>

	Tags: <a href="http://fritzthomas.com/tags/bash/" title="bash" rel="tag">bash</a>, <a href="http://fritzthomas.com/tags/linux/" title="Linux" rel="tag">Linux</a><br />

	<h4>&Auml;hnliche Beitr&auml;ge:</h4>
	<ul class="st-related-posts">
	<li><a href="http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/" title="Web Dev Appliance (January 13, 2008)">Web Dev Appliance</a> (16)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/12-aendern-oder-setzen-eines-statischen-netzwerk-device-namen-unter-gentoo-eth0-eth1ethn/" title="Setzen eines statischen Netzwerk Device Namen unter Gentoo. (eth0,eth1,&#8230;) (December 27, 2007)">Setzen eines statischen Netzwerk Device Namen unter Gentoo. (eth0,eth1,&#8230;)</a> (0)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/384-how-to-get-the-absolute-path-within-the-running-bash-script/" title="How to get the absolute path within the running bash script (February 6, 2009)">How to get the absolute path within the running bash script</a> (10)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://fritzthomas.com/open-source/linux/546-how-to-recursive-set-different-permissions-on-directories-and-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get absolute path within shell script &#8211; PART2</title>
		<link>http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/</link>
		<comments>http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 14:22:17 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[absolute path]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://fritzthomas.com/?p=551</guid>
		<description><![CDATA[This is an update and in depth look to my previous Blog post of &#8220;How to get absolute path within the running shell script&#8220;. In my previous post i used a solution with readlink which is not available everywhere. Especially on Mac OS there is no readlink. But, we do not need readlink anyway&#8230; A [...]]]></description>
			<content:encoded><![CDATA[<p>This is an update and in depth look to my <a href="http://fritzthomas.com/open-source/linux/384-how-to-get-the-absolute-path-within-the-running-bash-script/">previous Blog post</a> of &#8220;<a href="http://fritzthomas.com/open-source/linux/384-how-to-get-the-absolute-path-within-the-running-bash-script/">How to get absolute path within the running shell script</a>&#8220;.</p>
<p>
In my previous post i used a solution with readlink which is not available everywhere. Especially on Mac OS there is no readlink. But, we do not need readlink anyway&#8230;</p>
<p><span id="more-551"></span><br />
<div style="float:left;margin-left:0,margin-right:4px;margin-top:4px;margin-bottom:0;padding:4px;border:0;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ad_slot = "3802836967";
google_ad_width = 120;
google_ad_height = 240;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p>
A requisite for me was that one can easily reuse some functions and variables in every shell script. In that global included (or sourced) file i set some variables with absolute paths to directorys within a web application. Because you do not know where a script is called from, i had to canonicalize all paths to absolute paths, so it is absolutely safe to rely on that paths for further processing.</p>
<p>
Lets say you have a web application installed in /var/www/webapp. Let us call this path &#8216;Application Path&#8217;. In your Application Path you have a directory <code>tmp</code>, <code>log</code>, <code>bin</code> and <code>public</code> per convention. Your global sourced script is in <code>bin</code> &#8211; lets call it <code>environment.sh</code>. And one script called <code>webapp-setup</code> is also in this <code>bin</code> directory. This <script>webapp-setup</script> script gets called on a customers server and does all the magic voodoo to get your web application up and running. The &#8216;Voodoo&#8217; is most of the time some fancy search and replaces via sed or something similar and therefore you will need most of the time absolute paths.</p>
<p></p>
<p>
Let`s take a look at this environment.sh script:</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;"># bin/environment.sh</span>
<span style="color: #666666; font-style: italic;"># Original Path the script is called from.</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">ORIGINAL_PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(pwd)</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(dirname $0)</span>&quot;</span>
<span style="color: #666666; font-style: italic;"># Absolute Path to the bin Dir</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">BIN_PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(pwd)</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${ORIGINAL_PATH}</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">APPLICATION_PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(dirname ${BIN_PATH})</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PUBLIC_PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${APPLICATION_PATH}</span>/public&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">TMP_PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${APPLICATION_PATH}</span>/tmp&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LOG_PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${APPLICATION_PATH}</span>/log&quot;</span></pre></div></div>

<p>If you only access this variables within your bash scripts you can avoid using export. But if you execute a php script within your bash scripts you have to export them and use the <code>$_SERVER</code> Array. In this case you can access <code>TMP_PATH</code> via <code>$_SERVER['TMP_PATH']</code><br />

</p>
<p>
And the webapp-setup Script sources this global script</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>
<span style="color: #666666; font-style: italic;"># bin/webapp-setup</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># the '.' is the short form for 'source'</span>
. <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(dirname $0)</span>/environment.sh&quot;</span>
&nbsp;
<span style="color: #007800;">CONFIG_FILE</span>=<span style="color: #800000;">${APPLICATION_PATH}</span><span style="color: #000000; font-weight: bold;">/</span>config.ini
<span style="color: #666666; font-style: italic;"># After this you have an absolute path</span>
<span style="color: #666666; font-style: italic;"># to this configuration file within your web application.</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#...</span></pre></div></div>

</p>
<p><div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p>
Thats it. With that simple setup you can call this from every path on that machine. No matter it gets called <code>bin/webapp-setup</code> or <code>/var/www/webapp/bin/webapp-setup</code> or <code>webapp/bin/webapp-setup</code>. You will always get absolute existing paths within you shell scripts.</p>
<p>I hope you were able to follow my example. If it was helpful for you i would be thankful if you leave a comment</p>

	Tags: <a href="http://fritzthomas.com/tags/absolute-path/" title="absolute path" rel="tag">absolute path</a>, <a href="http://fritzthomas.com/tags/bash/" title="bash" rel="tag">bash</a>, <a href="http://fritzthomas.com/tags/linux/" title="Linux" rel="tag">Linux</a>, <a href="http://fritzthomas.com/tags/script/" title="script" rel="tag">script</a>, <a href="http://fritzthomas.com/tags/shell/" title="shell" rel="tag">shell</a><br />

	<h4>&Auml;hnliche Beitr&auml;ge:</h4>
	<ul class="st-related-posts">
	<li><a href="http://fritzthomas.com/open-source/linux/384-how-to-get-the-absolute-path-within-the-running-bash-script/" title="How to get the absolute path within the running bash script (February 6, 2009)">How to get the absolute path within the running bash script</a> (10)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/520-cloning-copying-a-complete-directory-tree-with-relative-paths-symlinks-and-hardlinks/" title="Cloning / copying a complete directory tree with relative paths symlinks and hardlinks (June 23, 2010)">Cloning / copying a complete directory tree with relative paths symlinks and hardlinks</a> (0)</li>
	<li><a href="http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/" title="Web Dev Appliance (January 13, 2008)">Web Dev Appliance</a> (16)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Clear / free memory on Linux</title>
		<link>http://fritzthomas.com/open-source/linux/524-clear-free-memory-on-linux/</link>
		<comments>http://fritzthomas.com/open-source/linux/524-clear-free-memory-on-linux/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 12:40:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open-Source]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://fritzthomas.com/?p=524</guid>
		<description><![CDATA[If you want to free the memory from all unused &#8220;crap&#8221; you can run this little one liner as root: sync;echo 3 &#62; /proc/sys/vm/drop_caches The sync command flushes all buffers from memory to disk so you are safe that you do not loose anything. Keep also in mind that not everything from the cleared memory [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to free the memory from all unused &#8220;crap&#8221; you can run this little one liner as root:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sync</span>;<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">3</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>vm<span style="color: #000000; font-weight: bold;">/</span>drop_caches</pre></div></div>

<p><div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p>The sync command flushes all buffers from memory to disk so you are safe that you do not loose anything. Keep also in mind that not everything from the cleared memory was crap. You dropped all caches &#8211; so expect that some things might run even slower.</p>

	Tags: <a href="http://fritzthomas.com/tags/bash/" title="bash" rel="tag">bash</a>, <a href="http://fritzthomas.com/tags/linux/" title="Linux" rel="tag">Linux</a><br />

	<h4>&Auml;hnliche Beitr&auml;ge:</h4>
	<ul class="st-related-posts">
	<li><a href="http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/" title="Web Dev Appliance (January 13, 2008)">Web Dev Appliance</a> (16)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/12-aendern-oder-setzen-eines-statischen-netzwerk-device-namen-unter-gentoo-eth0-eth1ethn/" title="Setzen eines statischen Netzwerk Device Namen unter Gentoo. (eth0,eth1,&#8230;) (December 27, 2007)">Setzen eines statischen Netzwerk Device Namen unter Gentoo. (eth0,eth1,&#8230;)</a> (0)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/546-how-to-recursive-set-different-permissions-on-directories-and-files/" title="How to recursive set different permissions on directories and files (July 7, 2010)">How to recursive set different permissions on directories and files</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://fritzthomas.com/open-source/linux/524-clear-free-memory-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cloning / copying a complete directory tree with relative paths symlinks and hardlinks</title>
		<link>http://fritzthomas.com/open-source/linux/520-cloning-copying-a-complete-directory-tree-with-relative-paths-symlinks-and-hardlinks/</link>
		<comments>http://fritzthomas.com/open-source/linux/520-cloning-copying-a-complete-directory-tree-with-relative-paths-symlinks-and-hardlinks/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 14:52:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://fritzthomas.com/?p=520</guid>
		<description><![CDATA[cd /home/USER tar cf - . &#124; &#40;cd /dir/where/you/want/to/copy &#38;&#38; tar xBf -&#41; This has some advantages over cp -rfp. You can read it in detail at O`Reilly Tags: backup, bash, Linux, shell, tar &#196;hnliche Beitr&#228;ge: How to get the absolute path within the running bash script (10) How to get absolute path within shell [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>USER
<span style="color: #c20cb9; font-weight: bold;">tar</span> cf - . <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>dir<span style="color: #000000; font-weight: bold;">/</span>where<span style="color: #000000; font-weight: bold;">/</span>you<span style="color: #000000; font-weight: bold;">/</span>want<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>copy <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> xBf -<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p><div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p>This has some advantages over <code>cp -rfp</code>. You can read it in detail at <a href="http://linuxdevcenter.com/pub/a/linux/lpt/18_16.html">O`Reilly</a></p>

	Tags: <a href="http://fritzthomas.com/tags/backup/" title="backup" rel="tag">backup</a>, <a href="http://fritzthomas.com/tags/bash/" title="bash" rel="tag">bash</a>, <a href="http://fritzthomas.com/tags/linux/" title="Linux" rel="tag">Linux</a>, <a href="http://fritzthomas.com/tags/shell/" title="shell" rel="tag">shell</a>, <a href="http://fritzthomas.com/tags/tar/" title="tar" rel="tag">tar</a><br />

	<h4>&Auml;hnliche Beitr&auml;ge:</h4>
	<ul class="st-related-posts">
	<li><a href="http://fritzthomas.com/open-source/linux/384-how-to-get-the-absolute-path-within-the-running-bash-script/" title="How to get the absolute path within the running bash script (February 6, 2009)">How to get the absolute path within the running bash script</a> (10)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/" title="How to get absolute path within shell script &#8211; PART2 (June 28, 2010)">How to get absolute path within shell script &#8211; PART2</a> (1)</li>
	<li><a href="http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/" title="Web Dev Appliance (January 13, 2008)">Web Dev Appliance</a> (16)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://fritzthomas.com/open-source/linux/520-cloning-copying-a-complete-directory-tree-with-relative-paths-symlinks-and-hardlinks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get the absolute path within the running bash script</title>
		<link>http://fritzthomas.com/open-source/linux/384-how-to-get-the-absolute-path-within-the-running-bash-script/</link>
		<comments>http://fritzthomas.com/open-source/linux/384-how-to-get-the-absolute-path-within-the-running-bash-script/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 09:39:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://fritzthomas.com/?p=384</guid>
		<description><![CDATA[Take a look at my updated post Have you ever needed the absolute path of the shell script within this script? I do not mean the current working dir (pwd). That is different, because you do not know from which path the bash script is called. In my case i needed the absolute path, because [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/">Take a look at my updated post</a></p>
<p>
Have you ever needed the absolute path of the shell script within this script? I do not mean the current working dir (pwd). That is different, because you do not know from which path the bash script is called.<br />
<div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p>
In my case i needed the absolute path, because i wanted to call another script, which is by convention, in the same directory as the called script. In such a case you would use realpath in PHP &#8211; readlink is the bash equivalent to it.</p>
<p></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Absolute path to this script. /home/user/bin/foo.sh</span>
<span style="color: #007800;">SCRIPT</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">readlink</span> <span style="color: #660033;">-f</span> $<span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #666666; font-style: italic;"># Absolute path this script is in. /home/user/bin</span>
<span style="color: #007800;">SCRIPTPATH</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #007800;">$SCRIPT</span><span style="color: #000000; font-weight: bold;">`</span></pre></td></tr></table></div>


	Tags: <a href="http://fritzthomas.com/tags/bash/" title="bash" rel="tag">bash</a>, <a href="http://fritzthomas.com/tags/howto/" title="howto" rel="tag">howto</a>, <a href="http://fritzthomas.com/tags/linux/" title="Linux" rel="tag">Linux</a>, <a href="http://fritzthomas.com/tags/php/" title="PHP" rel="tag">PHP</a>, <a href="http://fritzthomas.com/tags/script/" title="script" rel="tag">script</a>, <a href="http://fritzthomas.com/tags/shell/" title="shell" rel="tag">shell</a><br />

	<h4>&Auml;hnliche Beitr&auml;ge:</h4>
	<ul class="st-related-posts">
	<li><a href="http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/" title="How to get absolute path within shell script &#8211; PART2 (June 28, 2010)">How to get absolute path within shell script &#8211; PART2</a> (1)</li>
	<li><a href="http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/" title="Web Dev Appliance (January 13, 2008)">Web Dev Appliance</a> (16)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/520-cloning-copying-a-complete-directory-tree-with-relative-paths-symlinks-and-hardlinks/" title="Cloning / copying a complete directory tree with relative paths symlinks and hardlinks (June 23, 2010)">Cloning / copying a complete directory tree with relative paths symlinks and hardlinks</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://fritzthomas.com/open-source/linux/384-how-to-get-the-absolute-path-within-the-running-bash-script/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Rekursiv für bestimmte Dateien Dateioperation durchführen</title>
		<link>http://fritzthomas.com/open-source/linux/45-rekursiv-fur-bestimmte-dateien-dateioperation-durchfuhren/</link>
		<comments>http://fritzthomas.com/open-source/linux/45-rekursiv-fur-bestimmte-dateien-dateioperation-durchfuhren/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 14:26:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[dos2unix]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[svn propset]]></category>

		<guid isPermaLink="false">http://fritzthomas.com/linux/45-rekursiv-fur-bestimmte-dateien-dateioperation-durchfuhren/</guid>
		<description><![CDATA[Ich hatte das Problem das ich über ein ganzes Projektverzeichnis bei bestimmten Dateien (.php, .phtml, .js, .css) ein svn propset ausführen wollte. Unter Windows und TortoiseSVN hat man zwar die Möglichkeit über ein ganzes Verzeichnis rekursiv ein Property zu setzen, jedoch nicht nach Dateiendungen zu entscheiden ob es gesetzt werden soll. Eine einfache und schnelle [...]]]></description>
			<content:encoded><![CDATA[<p>Ich hatte das Problem das ich über ein ganzes Projektverzeichnis bei bestimmten Dateien (.php, .phtml, .js, .css) ein svn propset ausführen wollte. Unter Windows und TortoiseSVN hat man zwar die Möglichkeit über ein ganzes Verzeichnis rekursiv ein Property zu setzen, jedoch nicht nach Dateiendungen zu entscheiden ob es gesetzt werden soll. Eine einfache und schnelle Möglichkeit ist dazu das Unix/Linux Tool &#8216;find&#8217;.</p>
<p><span id="more-45"></span></p>
<p>Nach Dateien suchen und dabei Dateien in einem .svn Verzeichnis nicht durchsuchen. Auf jedes gefundene File ein svn propset anwenden:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td 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> <span style="color: #660033;">-wholename</span> \<span style="color: #000000; font-weight: bold;">*</span>.svn\<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #660033;">-type</span> f  \<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.php <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.phtml <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.css <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.js <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.ini \<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">svn</span> propset <span style="color: #c20cb9; font-weight: bold;">svn</span>:keywords <span style="color: #ff0000;">'Date Revision Author HeadURL Id'</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></td></tr></table></div>

<p><div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<p>Das ganze kann natuerlich auch fuer andere Dateioperationen angewandt werden wir zum Beispiel dos2unix:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td 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> <span style="color: #660033;">-wholename</span> \<span style="color: #000000; font-weight: bold;">*</span>.svn\<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #660033;">-type</span> f  \<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.php <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.phtml <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.css <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.js <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.html <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> \<span style="color: #000000; font-weight: bold;">*</span>.ini \<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #660033;">-exec</span> dos2unix <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></td></tr></table></div>

<p>Bei den Beispielen werden alle &#8216;.svn&#8217; Verzeichnisse nicht durchsucht: \! -wholename \*.svn\*<br />
Es wird nur nach Dateien gesucht: -type f<br />
Und nur nach Dateien mit der Endung .php .phtml .css .js .html .ini : \( -name \*.php -o -name \*.phtml -o -name \*.css -o -name \*.js -o -name \*.html -o -name \*.ini \)</p>

	Tags: <a href="http://fritzthomas.com/tags/bash/" title="bash" rel="tag">bash</a>, <a href="http://fritzthomas.com/tags/dos2unix/" title="dos2unix" rel="tag">dos2unix</a>, <a href="http://fritzthomas.com/tags/how-to/" title="how-to" rel="tag">how-to</a>, <a href="http://fritzthomas.com/tags/svn-propset/" title="svn propset" rel="tag">svn propset</a><br />

	<h4>&Auml;hnliche Beitr&auml;ge:</h4>
	<ul class="st-related-posts">
	<li><a href="http://fritzthomas.com/open-source/linux/12-aendern-oder-setzen-eines-statischen-netzwerk-device-namen-unter-gentoo-eth0-eth1ethn/" title="Setzen eines statischen Netzwerk Device Namen unter Gentoo. (eth0,eth1,&#8230;) (December 27, 2007)">Setzen eines statischen Netzwerk Device Namen unter Gentoo. (eth0,eth1,&#8230;)</a> (0)</li>
	<li><a href="http://fritzthomas.com/php/zend-framework/33-how-to-teil-1-projektaufbau-konventionen-und-modulare-verzeichnisstruktur/" title="Zend Framework How-To Teil 1: Projektaufbau, Konventionen und modulare Verzeichnisstruktur (January 28, 2008)">Zend Framework How-To Teil 1: Projektaufbau, Konventionen und modulare Verzeichnisstruktur</a> (13)</li>
	<li><a href="http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/" title="Web Dev Appliance (January 13, 2008)">Web Dev Appliance</a> (16)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://fritzthomas.com/open-source/linux/45-rekursiv-fur-bestimmte-dateien-dateioperation-durchfuhren/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Web Dev Appliance</title>
		<link>http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/</link>
		<comments>http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/#comments</comments>
		<pubDate>Sun, 13 Jan 2008 21:49:46 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Overall]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[fop]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[pdftk]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[VMware Appliance]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://fritzthomas.com/gentoo-web-development-vmware-appliance/</guid>
		<description><![CDATA[Gentoo PHP Web Development Appliance for VMware Download WebDev Appliance Version 1.1: Download Size: 1.4GB md5: fe1d6f6b90fd9a859cd8c6fbe669bf8b WebDev Appliance on VMware Marketplace I made this appliance because i needed a small appliance, small enough to store it on a USB Stick, because i am developing on my desktop PC and from time to time on [...]]]></description>
			<content:encoded><![CDATA[<h1>Gentoo PHP Web Development Appliance for VMware</h1>
<div class="inline-box" style="float:right;width:225px;height:325px;border:2px solid #CC6648;background-color:#ECF3F8;padding:3px;margin-left:10px;text-align:center;overflow:hidden;">
<h2>Download WebDev Appliance</h2>
<div style="margin:0px;padding:0px;font-size:1.1em;text-align:left">
Version 1.1: <a href="/vmware-appliances/webdev-appliance-1.1.7z">Download</a><br />
<span style="font-size:0.7em;color:#005B8E;line-height:10px;">Size: 1.4GB</span><br />
<span style="font-size:0.7em;color:#005B8E;line-height:10px;">md5: fe1d6f6b90fd9a859cd8c6fbe669bf8b<br />
<span style="font-size:1em;line-height:10px;"><a href="http://www.vmware.com/appliances/directory/1145">WebDev Appliance</a> on VMware Marketplace</span></p>
<hr />
<script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
//200x200, wedev-download
google_ad_slot = "8706097563";
google_ad_width = 200;
google_ad_height = 200;
//--></script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
</span></div>
</div>
<p style="text-align:justify">
I made this appliance because i needed a small appliance, small enough to store it on a USB Stick, because i am developing on my desktop PC and from time to time on my laptop when i am on train. So i wanted to have the same &#8220;server&#8221; environment for all my projects, wherever i am. </p>
<p><strong>My Needs were (basically):</strong></p>
<ul>
<li>Gentoo Hardened 2007.0 (No need, but i like it because its very flexible)</li>
<li>Apache 2</li>
<li>PHP 5</li>
<li>MySQL 5</li>
<li>fop</li>
<li>pdftk</li>
<li>per vhost configuration. PHP, Java Runtime Environment and different versions of executeables and scripts.</li>
<li>Zend Framework</li>
<li>PEAR</li>
</ul>
<p>Its was essential for me to have different Virtual Hosts, with each different configurations for PHP settings and Environment Variables. So i build the webserver application stack with apache2 mod_suxec and mod_fcgi and build php as cgi. With this configuration i am possible to configure each Virtual Host with different settings and run each virtual host with different uid and/or gid. (Thank you to <a href="http://johannes.truschnigg.info">Johannes Truschnigg</a>) Another requirement was, to run different versions of fop and pdftk (or any other executable) in each virtual host. To have this ability, in every vhost root directory is a &#8216;bin/&#8217; directory, where all executeables, needed from this vhost, should be. Each Virtual Host is configured with a FCGI Wrapper File and a different PATH Environment Variable. In this PATH Variable the &#8216;bin/&#8217; directory of the virtual host is the first path and the path to the &#8216;bin/&#8217; directory in the users home directory is the second path. So you can have different different sets of configuarations and different versions of executeables for each vhost and user.</p>
<p>Some imaginable Use Cases are:<br />
<strong>#1:</strong> In host1.local you need fop in version 0.94 and in host2.local you want fop in version 0.20.5. (fop is only an placeholder for any executable in this example)<br />
<strong>#2:</strong> For host1.local you want the Zend Debugger extension, in all other hosts you want the xdebug extension.<br />
<strong>#3:</strong> For an older application, installed on host1.local, you need register_globals set to on. On all other hosts you want to leave this option off (default).<br />
<strong>#4:</strong> A host which is a zend framework application needs a class which is currently in the incubator svn repository. Another host needs the zend framework in the preview version 0.60 and another host needs the latest version of the Zend Framework.</p>
<p><div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p><strong>Perhaps its helpful for you too. Please let me know what you think. Your feedback is welcome. <img src='http://fritzthomas.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  <a href="/contact/">Contact me</a></strong></p>
<hr />
<h1>Let`s start</h1>
<h2>User Logins and Passwords</h2>
<h3>Linux Users</h3>
<p><strong>User: </strong>root<br />
<strong>Password:</strong> devdev</p>
<p>Login via ssh as root is not allowed, login with develop instead and call &#8216;su&#8217;</p>
<p><strong>Development-User:</strong> develop<br />
<strong>Password: </strong>devdev</p>
<h3>MySQL Users</h3>
<p><strong>User:</strong> root<br />
<strong>Password:</strong> devdev<br />
phpmyadmin is already installed in default vhost.</p>
<hr />
<h2>Vhost Administration</h2>
<p>To start, login via ssh with User &#8216;develop&#8217;. After the password prompt you get asked if you want to attach a screen session.<br />
For more information about screen read this <a href="http://www.amitu.com/blog/2004/12/screen-howto.html">screen howto</a> or this<br />
<a href="http://de.gentoo-wiki.com/Screen_Tutorial">screen howto</a> in german language.</p>
<p>To help manage and administrate each vhost, i`ve created some scripts. This scripts are only available as user &#8216;develop&#8217;:</p>
<ul>
<li>vhost-create</li>
<li>vhost-delete</li>
<li>vhost-update</li>
</ul>
<p>Each vhost you create or update with this scripts have the same directory layout. The master files for each created host are in &#8216;/var/www/skel&#8217;. You can change the files in it, add files or directories as you want. The basic vhost directory layout should look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">develop<span style="color: #000000; font-weight: bold;">@</span>develop ~ $ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>
total <span style="color: #000000;">20</span>
drwxr-xr-x <span style="color: #000000;">2</span> develop develop <span style="color: #000000;">4096</span> Jan  <span style="color: #000000;">8</span> <span style="color: #000000;">19</span>:<span style="color: #000000;">31</span> bin
drwxr-xr-x <span style="color: #000000;">3</span> develop develop <span style="color: #000000;">4096</span> Jan  <span style="color: #000000;">8</span> <span style="color: #000000;">19</span>:<span style="color: #000000;">33</span> conf
drwxr-xr-x <span style="color: #000000;">2</span> develop develop <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">35</span> logs
drwxr-xr-x <span style="color: #000000;">2</span> develop develop <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">35</span> tmp
drwxr-xr-x <span style="color: #000000;">4</span> develop develop <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">35</span> www</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">develop<span style="color: #000000; font-weight: bold;">@</span>develop ~ $ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lR</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<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>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>:
total <span style="color: #000000;">20</span>
drwxr-xr-x <span style="color: #000000;">2</span> develop develop <span style="color: #000000;">4096</span> Jan  <span style="color: #000000;">8</span> <span style="color: #000000;">19</span>:<span style="color: #000000;">31</span> bin
drwxr-xr-x <span style="color: #000000;">3</span> develop develop <span style="color: #000000;">4096</span> Jan  <span style="color: #000000;">8</span> <span style="color: #000000;">19</span>:<span style="color: #000000;">33</span> conf
drwxr-xr-x <span style="color: #000000;">2</span> develop develop <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">35</span> logs
drwxr-xr-x <span style="color: #000000;">2</span> develop develop <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">35</span> tmp
drwxr-xr-x <span style="color: #000000;">4</span> develop develop <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">35</span> www
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>bin:
total <span style="color: #000000;">0</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>conf:
total <span style="color: #000000;">12</span>
drwxr-xr-x <span style="color: #000000;">2</span> develop develop <span style="color: #000000;">4096</span> Jan <span style="color: #000000;">11</span> <span style="color: #000000;">20</span>:<span style="color: #000000;">38</span> php
<span style="color: #660033;">-rwxr--r--</span> <span style="color: #000000;">1</span> develop develop <span style="color: #000000;">1621</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">11</span>:<span style="color: #000000;">19</span> vhost.conf
<span style="color: #660033;">-rwxr--r--</span> <span style="color: #000000;">1</span> develop develop  <span style="color: #000000;">325</span> Jan  <span style="color: #000000;">8</span> <span style="color: #000000;">19</span>:<span style="color: #000000;">32</span> wrapper.fcgi
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>php:
total <span style="color: #000000;">48</span>
<span style="color: #660033;">-rwxr--r--</span> <span style="color: #000000;">1</span> develop develop <span style="color: #000000;">46286</span> Jan <span style="color: #000000;">11</span> <span style="color: #000000;">12</span>:<span style="color: #000000;">43</span> php.ini
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>logs:
total <span style="color: #000000;">0</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>tmp:
total <span style="color: #000000;">0</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>www:
total <span style="color: #000000;">8</span>
drwxr-xr-x <span style="color: #000000;">2</span> develop develop <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">35</span> htdocs
drwxr-xr-x <span style="color: #000000;">2</span> develop develop <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">35</span> includes
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>htdocs:
total <span style="color: #000000;">4</span>
<span style="color: #660033;">-rwxr--r--</span> <span style="color: #000000;">1</span> develop develop <span style="color: #000000;">14</span> Dec <span style="color: #000000;">27</span> <span style="color: #000000;">11</span>:<span style="color: #000000;">19</span> info.php
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>skel<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>includes:
total <span style="color: #000000;">0</span></pre></div></div>

<h3>vhost-create</h3>
<p>It creates a new vhost. Just call vhost-create with no paramters. Its very simple and asks you some questions. Then it copies the &#8220;template&#8221; directory (/var/www/skel) to the vhost destination in /var/www/domains with the name you entered before. As default convention, every new vhost has the domain name suffix .local as ServerName. To change this to an existing domain name in your network (e.g.: [HOSTNAME].home.lan), change the vhost.conf file in the vhost template directory (/var/www/skel/conf/vhost.conf).</p>
<h3>vhost-delete</h3>
<p>Just call it and enter the name of the vhost you want to delete. </p>
<h3>vhost-update</h3>
<p>Use it if you changed a template file in /var/www/skel and you want to update some vhosts with this new configurations. Use this script if you changed something in /var/www/skel and you want to update one or more vhosts with this changes. Just call it, enter the name of the vhost, ready.</p>
<p><strong>FOR ALL STEPS ABOVE ITS NECESSARY TO RESTART APACHE AFTERWARDS, SO CHANGES ARE EFFECTIVE !</strong></p>
<hr />
<h2>Access Vhosts over the network</h2>
<p>To access the files of a created host with an IDE (Integrated Development Environment) like Zend Studio or Zend Studio for Eclipse, the home directory of &#8216;develop&#8217; and the directory &#8216;/var/www/&#8217; is exported via NFS and Samba.<br />
If you use <strong>Linux</strong>, access your hosts via NFS. Therefore you have to mount the directory /var/www:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">thomas<span style="color: #000000; font-weight: bold;">@</span>gentoo ~ $ <span style="color: #c20cb9; font-weight: bold;">mount</span> 192.168.199.128:<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>thomas<span style="color: #000000; font-weight: bold;">/</span>development</pre></div></div>

<p>Do you use <strong>Windows</strong>? Access your vhosts over the network neighbourhood, or Map a new Network Drive to &#8220;\\192.168.199.128\www&#8221;. Use the above username (develop) and password to get access.</p>
<hr />
<h2>Librarys and Frameworks</h2>
<p>The <a href="http://framework.zend.com/">Zend Framework</a> is preinstalled in /var/www/librarys/ZendFramework. I checked out the svn trunk and the incubator in different directorys. Change your include_path within your bootstrap file to the location you want.<br />
You can use more Librarys and Frameworks like <a href="http://cakephp.org/">Cake</a>, <a href="http://www.symfony-project.org/">Symfony</a> or <a href="http://www.solarphp.com/">SolarPHP</a>. Put this frameworks into a subdirectory of /var/www/librarys and then change the include_path.</p>
<hr />
<p><div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<hr />
<h2>Configuration</h2>
<p>Timezone is set to GMT. Read <a href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&#038;chap=7#doc_chap1">this</a> how to change your timezone.<br />
Keymap is set to &#8220;us&#8221;. Change it in /etc/conf.d/keymaps.<br />
If you want to send email from your development appliance you have to change the mailhub config value in /etc/ssmtp/ssmtp.conf to a mail relay which accepts you.<br />
Networking is set to dhcp. If you want to change this, take a look in /etc/conf.d/net.<br />
For all other configuration related topics take a look at the <a href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1">Gentoo Handbook</a>.</p>
<h3>rc-update show</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">develop develop <span style="color: #666666; font-style: italic;"># rc-update show</span>
             apache2 <span style="color: #000000; font-weight: bold;">|</span>      default
            bootmisc <span style="color: #000000; font-weight: bold;">|</span> boot
             checkfs <span style="color: #000000; font-weight: bold;">|</span> boot
           checkroot <span style="color: #000000; font-weight: bold;">|</span> boot
               clock <span style="color: #000000; font-weight: bold;">|</span> boot
         consolefont <span style="color: #000000; font-weight: bold;">|</span> boot
            <span style="color: #c20cb9; font-weight: bold;">hostname</span> <span style="color: #000000; font-weight: bold;">|</span> boot
             keymaps <span style="color: #000000; font-weight: bold;">|</span> boot
               <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #000000; font-weight: bold;">|</span>      default nonetwork
          localmount <span style="color: #000000; font-weight: bold;">|</span> boot
             modules <span style="color: #000000; font-weight: bold;">|</span> boot
               mysql <span style="color: #000000; font-weight: bold;">|</span>      default
            net.eth0 <span style="color: #000000; font-weight: bold;">|</span>      default
              net.lo <span style="color: #000000; font-weight: bold;">|</span> boot
            netmount <span style="color: #000000; font-weight: bold;">|</span>      default
                 nfs <span style="color: #000000; font-weight: bold;">|</span>      default
             portmap <span style="color: #000000; font-weight: bold;">|</span>      default
           rmnologin <span style="color: #000000; font-weight: bold;">|</span> boot
               samba <span style="color: #000000; font-weight: bold;">|</span>      default
                sshd <span style="color: #000000; font-weight: bold;">|</span>      default
           syslog-ng <span style="color: #000000; font-weight: bold;">|</span>      default
             urandom <span style="color: #000000; font-weight: bold;">|</span> boot
          vixie-cron <span style="color: #000000; font-weight: bold;">|</span>      default</pre></div></div>

<h3>make.conf</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">develop<span style="color: #000000; font-weight: bold;">@</span>develop ~ $ <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>make.conf
<span style="color: #007800;">CFLAGS</span>=<span style="color: #ff0000;">&quot;-O2 -march=i686 -pipe -fomit-frame-pointer -fforce-addr&quot;</span>
<span style="color: #007800;">CXXFLAGS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${CFLAGS}</span>&quot;</span>
<span style="color: #007800;">CHOST</span>=<span style="color: #ff0000;">&quot;i686-pc-linux-gnu&quot;</span>
<span style="color: #007800;">MAKEOPTS</span>=<span style="color: #ff0000;">&quot;-j2&quot;</span>
<span style="color: #007800;">FEATURES</span>=<span style="color: #ff0000;">&quot;parallel-fetch noinfo&quot;</span>
<span style="color: #666666; font-style: italic;">#GENTOO_MIRRORS=&quot;http://gentoo.inode.at/&quot;</span>
<span style="color: #007800;">INPUT_DEVICES</span>=<span style="color: #ff0000;">&quot;keyboard vmmouse&quot;</span>
<span style="color: #007800;">VIDEO_CARDS</span>=<span style="color: #ff0000;">&quot;vmware fbdev vesa&quot;</span>
<span style="color: #007800;">PORTAGE_TMPFS</span>=<span style="color: #ff0000;">&quot;/dev/shm&quot;</span>
<span style="color: #007800;">USE</span>=<span style="color: #ff0000;">&quot;-X -xorg -alsa -oss -esd -dbus -truetype -acl -nls -doc -gpm -ipv6 -ftp -qt -qt3 -qt4 -kde -gnome -gtk -gtk2 -snmp -mailwrapper -cups -samba -ldap apache2 utf8 threads memlimit logrotate mmx nptl posix tcpd readline sasl sse ssl sysvipc unicode zlib X509 x86 bash-completion vim-syntax crypt sse2 pcre jpeg jpeg2k xvid xml&quot;</span>
<span style="color: #007800;">APACHE2_MODULES</span>=<span style="color: #ff0000;">&quot;actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias&quot;</span>
<span style="color: #007800;">APACHE2_MPMS</span>=<span style="color: #ff0000;">&quot;prefork&quot;</span></pre></div></div>

<h3>Portage package.use</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">develop<span style="color: #000000; font-weight: bold;">@</span>develop ~ $ <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>portage<span style="color: #000000; font-weight: bold;">/</span>package.use
dev-java<span style="color: #000000; font-weight: bold;">/</span>xmlgraphics-commons jpeg
dev-lang<span style="color: #000000; font-weight: bold;">/</span>php cgi <span style="color: #660033;">-calendar</span> force-cgi-redirect filter gd <span style="color: #660033;">-imap</span> suhosin mysqli mysql bcmath <span style="color: #c20cb9; font-weight: bold;">bzip2</span> ctype curl exif inifile json <span style="color: #660033;">-ldap</span> mhash mcrypt mbstring pdo session simplexml soap sqlite tidy cli xml xmlrpc xmlreader xmlwriter xsl <span style="color: #c20cb9; font-weight: bold;">zip</span> mysql sockets gmp spl reflection <span style="color: #c20cb9; font-weight: bold;">ftp</span> iconv sqlite <span style="color: #660033;">-apache2</span>
sys-devel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">gcc</span> gcj
virtual<span style="color: #000000; font-weight: bold;">/</span>editor bash-completion <span style="color: #c20cb9; font-weight: bold;">perl</span> python
net-fs<span style="color: #000000; font-weight: bold;">/</span>samba automount syslog acl async
sys-libs<span style="color: #000000; font-weight: bold;">/</span>glibc userlocales
<span style="color: #666666; font-style: italic;">#www-servers/apache mpm-prefork</span>
www-servers<span style="color: #000000; font-weight: bold;">/</span>apache <span style="color: #660033;">-threads</span> suexec
dev-util<span style="color: #000000; font-weight: bold;">/</span>subversion <span style="color: #660033;">-apache2</span> <span style="color: #660033;">-ruby</span> java <span style="color: #660033;">-perl</span> python <span style="color: #660033;">-nowebdav</span>
dev-libs<span style="color: #000000; font-weight: bold;">/</span>cyrus-sasl <span style="color: #660033;">-ldap</span>
dev-libs<span style="color: #000000; font-weight: bold;">/</span>apr-util mysql sqlite sqlite3
media-gfx<span style="color: #000000; font-weight: bold;">/</span>imagemagick <span style="color: #c20cb9; font-weight: bold;">bzip2</span> jpeg jpeg2k mpeg png tiff truetype xml
media-libs<span style="color: #000000; font-weight: bold;">/</span>jasper jpeg
media-video<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ffmpeg</span> a52 aac encode imlib network ogg truetype vorbis
media-libs<span style="color: #000000; font-weight: bold;">/</span>imlib2 gif <span style="color: #c20cb9; font-weight: bold;">bzip2</span> mp3 png tiff</pre></div></div>

<h3>Portage World File (Installed Software)</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">develop develop <span style="color: #666666; font-style: italic;"># cat /var/lib/portage/world</span>
app-admin<span style="color: #000000; font-weight: bold;">/</span>syslog-ng
app-misc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">screen</span>
app-portage<span style="color: #000000; font-weight: bold;">/</span>gentoolkit
app-text<span style="color: #000000; font-weight: bold;">/</span>pdftk
dev-db<span style="color: #000000; font-weight: bold;">/</span>mysql
dev-java<span style="color: #000000; font-weight: bold;">/</span>fop
dev-java<span style="color: #000000; font-weight: bold;">/</span>java-config
dev-java<span style="color: #000000; font-weight: bold;">/</span>xmlgraphics-commons
dev-lang<span style="color: #000000; font-weight: bold;">/</span>php
dev-libs<span style="color: #000000; font-weight: bold;">/</span>apr-util
dev-php<span style="color: #000000; font-weight: bold;">/</span>PEAR-PEAR
dev-util<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">cvs</span>
dev-util<span style="color: #000000; font-weight: bold;">/</span>subversion
media-gfx<span style="color: #000000; font-weight: bold;">/</span>imagemagick
media-video<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ffmpeg</span>
net-analyzer<span style="color: #000000; font-weight: bold;">/</span>ngrep
net-dns<span style="color: #000000; font-weight: bold;">/</span>bind-tools
net-fs<span style="color: #000000; font-weight: bold;">/</span>nfs-utils
net-fs<span style="color: #000000; font-weight: bold;">/</span>samba
net-misc<span style="color: #000000; font-weight: bold;">/</span>dhcpcd
net-misc<span style="color: #000000; font-weight: bold;">/</span>neon
net-misc<span style="color: #000000; font-weight: bold;">/</span>ntp
net-misc<span style="color: #000000; font-weight: bold;">/</span>openvpn
sys-apps<span style="color: #000000; font-weight: bold;">/</span>paxctl
sys-apps<span style="color: #000000; font-weight: bold;">/</span>slocate
sys-boot<span style="color: #000000; font-weight: bold;">/</span>grub
sys-devel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">gcc</span>
sys-fs<span style="color: #000000; font-weight: bold;">/</span>sysfsutils
sys-kernel<span style="color: #000000; font-weight: bold;">/</span>genkernel
sys-kernel<span style="color: #000000; font-weight: bold;">/</span>hardened-sources
sys-kernel<span style="color: #000000; font-weight: bold;">/</span>hardened-sources:2.6.22-r8
sys-kernel<span style="color: #000000; font-weight: bold;">/</span>hardened-sources:2.6.23-r4
sys-process<span style="color: #000000; font-weight: bold;">/</span>lsof
sys-process<span style="color: #000000; font-weight: bold;">/</span>vixie-cron
virtual<span style="color: #000000; font-weight: bold;">/</span>libstdc++:<span style="color: #000000;">3.3</span>
www-apache<span style="color: #000000; font-weight: bold;">/</span>mod_fcgid
www-servers<span style="color: #000000; font-weight: bold;">/</span>apache</pre></div></div>

<hr />
<h2>Notice</h2>
<p>This appliance is not intended for productive use. Its not tested and has not yet approved for this purpose. If you want to use this as a basis for a productive use, you can but &#8211; you  should make your own tests and changes. Again, the purpose for this appliance for development!! If you use this appliance you do it at your own risk and you are responsible for any damage.</p>

	Tags: <a href="http://fritzthomas.com/tags/apache/" title="apache" rel="tag">apache</a>, <a href="http://fritzthomas.com/tags/bash/" title="bash" rel="tag">bash</a>, <a href="http://fritzthomas.com/tags/development/" title="development" rel="tag">development</a>, <a href="http://fritzthomas.com/tags/fop/" title="fop" rel="tag">fop</a>, <a href="http://fritzthomas.com/tags/gentoo/" title="gentoo" rel="tag">gentoo</a>, <a href="http://fritzthomas.com/tags/linux/" title="Linux" rel="tag">Linux</a>, <a href="http://fritzthomas.com/tags/mysql/" title="MySQL" rel="tag">MySQL</a>, <a href="http://fritzthomas.com/tags/pdftk/" title="pdftk" rel="tag">pdftk</a>, <a href="http://fritzthomas.com/tags/pear/" title="PEAR" rel="tag">PEAR</a>, <a href="http://fritzthomas.com/tags/php/" title="PHP" rel="tag">PHP</a>, <a href="http://fritzthomas.com/tags/vmware/" title="vmware" rel="tag">vmware</a>, <a href="http://fritzthomas.com/tags/vmware-appliance/" title="VMware Appliance" rel="tag">VMware Appliance</a>, <a href="http://fritzthomas.com/tags/zend-framework/" title="Zend Framework" rel="tag">Zend Framework</a><br />

	<h4>&Auml;hnliche Beitr&auml;ge:</h4>
	<ul class="st-related-posts">
	<li><a href="http://fritzthomas.com/php/24-zend-framework-web-developer-appliance/" title="Zend Framework Web Developer Appliance (January 15, 2008)">Zend Framework Web Developer Appliance</a> (1)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/12-aendern-oder-setzen-eines-statischen-netzwerk-device-namen-unter-gentoo-eth0-eth1ethn/" title="Setzen eines statischen Netzwerk Device Namen unter Gentoo. (eth0,eth1,&#8230;) (December 27, 2007)">Setzen eines statischen Netzwerk Device Namen unter Gentoo. (eth0,eth1,&#8230;)</a> (0)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/384-how-to-get-the-absolute-path-within-the-running-bash-script/" title="How to get the absolute path within the running bash script (February 6, 2009)">How to get the absolute path within the running bash script</a> (10)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Setzen eines statischen Netzwerk Device Namen unter Gentoo. (eth0,eth1,&#8230;)</title>
		<link>http://fritzthomas.com/open-source/linux/12-aendern-oder-setzen-eines-statischen-netzwerk-device-namen-unter-gentoo-eth0-eth1ethn/</link>
		<comments>http://fritzthomas.com/open-source/linux/12-aendern-oder-setzen-eines-statischen-netzwerk-device-namen-unter-gentoo-eth0-eth1ethn/#comments</comments>
		<pubDate>Thu, 27 Dec 2007 16:33:18 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://fritzthomas.com/archives/2007/12/aendern-oder-setzen-eines-statischen-netzwerk-device-namen-unter-gentoo-eth0-eth1ethn/</guid>
		<description><![CDATA[Wird durch den Kernel eine neue Mac Adresse erkannt, wird angenommen das es sich dabei um ein neues Netzwerk Interface handelt. Dieses neue Device muss anschließend auch neu konfiguriert werden. Soweit so gut. Möchte man aber seine Netzwerkkarte gegen eine neue tauschen, aber denselben Device Namen behalten, um so die evtl. bereits erstellte und wahrscheinlich [...]]]></description>
			<content:encoded><![CDATA[<p>Wird durch den Kernel eine neue Mac Adresse erkannt, wird angenommen das es sich dabei um ein <em>neues</em> Netzwerk Interface handelt. Dieses neue Device muss anschließend  auch <em>neu</em> konfiguriert werden.</p>
<p><div style="width:100%;text-align:center;padding:0;margin:0;border:0;overflow:hidden;clear:both;"><script type="text/javascript"><!--
google_ad_client = "pub-1963733382421272";
google_ui_features = "rc:0";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_alternate_ad_color = "ffffff";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "319BD8";
google_color_text = "666666";
google_color_url = "319BD8";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p>Soweit so gut. Möchte man aber seine Netzwerkkarte gegen eine neue <em>tauschen</em>, aber denselben Device Namen behalten, um so die evtl. bereits erstellte und wahrscheinlich auch funktionierende Konfiguration (Netzwerkkonfiguration, iptables,&#8230;) zu verwenden, kann mittels udev Regeln der neuen Mac Adresse einen statischen Namen zuweisen.</p>
<p>Das ist auch dann hilfreich wenn man eine Linux <strong>VMware</strong> Appliance kopiert, und eine neue UUID generieren l&auml;sst, um zum Beispiel mehrere &#8220;identische&#8221; Appliances im selben Netzwerk zu betreiben. Das neu generieren ändert auch die Mac Adresse der virtuellen Netzwerkkarte und somit wird auch ein neues Interface angelegt. Was vorher eth0 war wird dann zu eth1 und muss auch wieder neu konfiguriert werden.<br />
Will man einfach <a href="/allgemein/19-manuell-die-mac-adresse-einer-vmware-appliance-andern/">manuell die Mac Adresse einer Appliance &auml;ndern</a> oder zuweisen, um immer dieselbe MAC Adresse zu haben auch wenn die Appliance kopiert wird seht <a href="/allgemein/19-manuell-die-mac-adresse-einer-vmware-appliance-andern/">hier</a>.</p>
<p><span id="more-12"></span></p>
<p>Um sich das neu Konfigurieren zu ersparen kann man mit einer einfachen udev Regel den Namen des Devices setzen.</p>
<h2>Mac Adresse rausfinden</h2>
<p>Zuerst müssen wir die neue Mac Adresse rausfinden.<br />
Entweder die Ausgabe von ifconfig verrät uns schon die Mac Adresse (HWaddr XX:XX:XX:XX:XX:XX):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #660033;">-a</span>
eth1      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe06:<span style="color: #000000;">528</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">64</span> Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:<span style="color: #000000;">1500</span>  Metric:<span style="color: #000000;">1</span>
          RX packets:<span style="color: #000000;">14656</span> errors:<span style="color: #000000;">0</span> dropped:<span style="color: #000000;">0</span> overruns:<span style="color: #000000;">0</span> frame:<span style="color: #000000;">0</span>
          TX packets:<span style="color: #000000;">13877</span> errors:<span style="color: #000000;">0</span> dropped:<span style="color: #000000;">0</span> overruns:<span style="color: #000000;">0</span> carrier:<span style="color: #000000;">0</span>
          collisions:<span style="color: #000000;">0</span> txqueuelen:<span style="color: #000000;">1000</span>
          RX bytes:<span style="color: #000000;">5958558</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">5.6</span> Mb<span style="color: #7a0874; font-weight: bold;">&#41;</span>  TX bytes:<span style="color: #000000;">2020530</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1.9</span> Mb<span style="color: #7a0874; font-weight: bold;">&#41;</span>
          Interrupt:<span style="color: #000000;">16</span> Base address:0x1400</pre></div></div>

<p>oder aber udevinfo:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">udevinfo <span style="color: #660033;">-a</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>eth1 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> address
    ATTR<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;XX:XX:XX:XX:XX:XX&quot;</span></pre></div></div>

<p>Wenn man die Mac Adresse einer vmware Appliance herausfinden will, ist es ganz einfach. Die &#8220;.vmx&#8221; Datei der Appliance mit einem Texteditor offnen. Die Mac Adresse wird nach &#8220;ethernet0.generatedAddress&#8221; gespeichert. In derselben Datei findet man auch auch die UUID. Die wird in &#8220;uuid.location&#8221; und &#8220;uuid.bios&#8221; gespeichert.</p>
<h2>Namen für das Device setzen / ändern</h2>
<p>Mit der Mac Adresse die wir jetzt wissen, können wir eine neue Udev Regel erstellen und einen beliebigen Namen setzen. Also können wir aus eth1 ein eth0 machen.</p>
<p>Unter <strong>Gentoo</strong> werden die Regeln in <strong>/etc/udev/rules.d</strong> gespeichert.<br />
Unsere neue Regel speichern wir in ein neues File.<br />
<strong>/etc/udev/rules.d/10-rules.local</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, ATTR<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;XX:XX:XX:XX:XX:XX&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth0&quot;</span></pre></div></div>

<p>Die Mac Adresse (&#8220;XX:XX:XX:XX:XX:XX&#8221;) und den Namen (&#8220;eth0&#8243;) muesst ihr natürlich mit eurer Mac Adresse und euren Wunschnamen ersetzen.</p>
<p>Das obige Beispiel wird also das Device mit der Mac Adresse XX:XX:XX:XX:XX:XX mit dem Namen eth0 erstellen und nicht eth1 wie in unserem Beispiel.<br />
Man kann auch sprechendere Namen verwenden, wenn man mehrere Devices für verschiedene Dienste verwendet und man sich keine Zahlen merken will (oder kann)<br />
Zum Beispiel: eth_www und eth_db oder eth_lan und eth_wan. Alles ist möglich.</p>
<p>Ändert sich die Mac Adresse erneut, zum Beispiel beim erneuten generieren der UUID unter VMware, muss natürlich in <strong>/etc/udev/rules.d/10-local.rules</strong> die neue Mac Adresse nachgetragen werden.</p>
<p>Wie man den Namen unter Ubuntu ändert findet man <a href="http://www.ubuntu-forum.de/artikel/15909/GELOeST-bezeichnung-der-Netzwerkkarte-aendern.html">HIER</a></p>

	Tags: <a href="http://fritzthomas.com/tags/bash/" title="bash" rel="tag">bash</a>, <a href="http://fritzthomas.com/tags/gentoo/" title="gentoo" rel="tag">gentoo</a>, <a href="http://fritzthomas.com/tags/how-to/" title="how-to" rel="tag">how-to</a>, <a href="http://fritzthomas.com/tags/linux/" title="Linux" rel="tag">Linux</a>, <a href="http://fritzthomas.com/tags/vmware/" title="vmware" rel="tag">vmware</a><br />

	<h4>&Auml;hnliche Beitr&auml;ge:</h4>
	<ul class="st-related-posts">
	<li><a href="http://fritzthomas.com/gentoo-php-web-development-vmware-appliance/" title="Web Dev Appliance (January 13, 2008)">Web Dev Appliance</a> (16)</li>
	<li><a href="http://fritzthomas.com/open-source/linux/22-7zip-unter-gentoo-linux-verwenden/" title="7zip unter Gentoo Linux verwenden (January 11, 2008)">7zip unter Gentoo Linux verwenden</a> (1)</li>
	<li><a href="http://fritzthomas.com/php/24-zend-framework-web-developer-appliance/" title="Zend Framework Web Developer Appliance (January 15, 2008)">Zend Framework Web Developer Appliance</a> (1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://fritzthomas.com/open-source/linux/12-aendern-oder-setzen-eines-statischen-netzwerk-device-namen-unter-gentoo-eth0-eth1ethn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
