<?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>The WebZappr &#187; linux</title>
	<atom:link href="http://blog.webzappr.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.webzappr.com</link>
	<description>The Random Web Snippets of a Web Zapper</description>
	<lastBuildDate>Wed, 21 Jul 2010 00:14:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Network backup with netcat (nc) and tar</title>
		<link>http://blog.webzappr.com/2009/10/network-backup-with-netcat-nc-and-tar/</link>
		<comments>http://blog.webzappr.com/2009/10/network-backup-with-netcat-nc-and-tar/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 15:37:48 +0000</pubDate>
		<dc:creator>Thorsten</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[nc]]></category>
		<category><![CDATA[netcat]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://blog.webzappr.com/?p=13855</guid>
		<description><![CDATA[Sometimes I need to recover some data from a server via network and either don&#8217;t have enough space on the source server I want to backup or just want to get things copied to an other server really quickly.
In this cases I usually just use the abilities of tar and netcat to create a backup [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I need to recover some data from a server via network and either don&#8217;t have enough space on the source server I want to backup or just want to get things copied to an other server really quickly.</p>
<p>In this cases I usually just use the abilities of <a href="http://www.gnu.org/software/tar/">tar</a> and <a href="http://en.wikipedia.org/wiki/Netcat">netcat</a> to create a backup via the network. </p>
<p>Let&#8217;s assume we have two computers:</p>
<p>- Computer A) which will be backed up.<br />
- Computer B), which ip addess is our REMOTE_IP and the backup  will be stored in this computer.</p>
<p>To create a backup we login to Computer B and launch netcat in listening mode using the following command.</p>
<pre class="brush: bash;">nc -l -p 6969 &gt;/root/backup.tgz</pre>
<p>This command tells netcat to start listening on port 6969 (you can use other free ports) and sends whatever it receives to /root/backup.tgz.</p>
<p>Once done the following command, executed on computer A will start the backup:</p>
<pre class="brush: bash;">sudo tar cvzp --same-owner --exclude=/root/backup.log --exclude=/proc/* --exclude=/media/* --exclude=/dev/* --exclude=/mnt/* --exclude=/sys/* --exclude=/tmp/* / 2&gt;/root/backup.log | nc -w 3 REMOTE_IP 6969</pre>
<p>This will create a full backup of your computer and excludes various system files which usually should not be copied. It also creates a logfile in /root/backup.log. </p>
<p><em>NOTES</em>
<ul>
<li>make sure to replace REMOTE_IP with the ip address of computer B and that the port number 6969 matches the one on computer B.</li>
<li>sometimes you might not have netcat available as &#8220;nc&#8221; and you need to type &#8220;netcat&#8221; instead.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.webzappr.com/2009/10/network-backup-with-netcat-nc-and-tar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get a list of urls/domains from a text file</title>
		<link>http://blog.webzappr.com/2008/11/get-a-list-of-urlsdomains-from-a-text-file/</link>
		<comments>http://blog.webzappr.com/2008/11/get-a-list-of-urlsdomains-from-a-text-file/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 20:05:27 +0000</pubDate>
		<dc:creator>Thorsten</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[extract domains]]></category>
		<category><![CDATA[extract urls]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://snipplr.wordpress.com/2008/11/05/get-a-list-of-urlsdomains-from-a-text-file/</guid>
		<description><![CDATA[I was just in need of a little script that extracts all urls from a text file. Here is the result.
sed 's/http/\^http/g' FILENAME &#124; tr -s &#34;^&#34; &#34;\n&#34; &#124; grep http&#124; sed 's/[\ &#124;\\\&#124;\&#34;].*//g' &#124; sed &#34;s/['].*//g&#34; &#124; sort &#124; uniq
And as my final goal was to extract a list of domain names from the [...]]]></description>
			<content:encoded><![CDATA[<p>I was just in need of a little script that extracts all urls from a text file. Here is the result.</p>
<pre class="brush: php;">sed 's/http/\^http/g' FILENAME | tr -s &quot;^&quot; &quot;\n&quot; | grep http| sed 's/[\ |\\\|\&quot;].*//g' | sed &quot;s/['].*//g&quot; | sort | uniq</pre>
<p>And as my final goal was to extract a list of domain names from the file which I can later use in my php script here is the hardcore version which gives you a copy&amp;paste array definition of all domains found in a file.</p>
<pre class="brush: php;">echo -n '$domains = array ( &quot;' ; sed 's/http/\^http/g' FILENAME | tr -s &quot;^&quot; &quot;\n&quot; | grep http| sed 's/[\ |\\\|\&quot;].*//g' | sed &quot;s/['].*//g&quot; | sort | uniq | awk 'BEGIN{FS=&quot;/&quot;}{print $3}' | cut -d . -f 2- | grep -E '^[a-z]+\.[a-z]+$' | sort | uniq | tr &quot;\n&quot; &quot;,&quot; | sed &quot;s/,/\&quot;, \&quot;/ig&quot; | sed 's/, \&quot;$//ig'; echo -n ' );'</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.webzappr.com/2008/11/get-a-list-of-urlsdomains-from-a-text-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fix Moveable Type Export with Metatag TAGS instead of KEYWORDS</title>
		<link>http://blog.webzappr.com/2008/10/fix-moveable-type-export-with-metatag-tags-instead-of-keywords/</link>
		<comments>http://blog.webzappr.com/2008/10/fix-moveable-type-export-with-metatag-tags-instead-of-keywords/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 21:44:16 +0000</pubDate>
		<dc:creator>Thorsten</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[metatag]]></category>
		<category><![CDATA[movabletype]]></category>
		<category><![CDATA[mt]]></category>
		<category><![CDATA[tags]]></category>

		<guid isPermaLink="false">http://snipplr.wordpress.com/2008/10/26/fix-moveable-type-export-with-metatag-tags-instead-of-keywords/</guid>
		<description><![CDATA[Sometimes a Moveable Type export puts the tags in a Metatag field called TAGS. Sadly this kind of export file does not preserve the keywords/tags when it is imported in Wordpress. Here is a little fix to get these TAGS converted to KEYWORDS.
cat original.txt &#124; sed '/^TAGS/s/ /,/ig' &#124; sed '/^TAGS/s/&#34;//ig' &#62; converted1.txt ;let lines=`cat [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes a Moveable Type export puts the tags in a Metatag field called TAGS. Sadly this kind of export file does not preserve the keywords/tags when it is imported in Wordpress. Here is a little fix to get these TAGS converted to KEYWORDS.</p>
<pre class="brush: php;">cat original.txt | sed '/^TAGS/s/ /,/ig' | sed '/^TAGS/s/&quot;//ig' &gt; converted1.txt ;let lines=`cat converted1.txt|wc -l`; let lines=`expr &quot;$lines&quot; : '\([0-9]*\)'`; for i in `seq 1 $lines`; do line=`head -n $i converted1.txt | tail -n 1`; istag=`echo $line|grep -E &quot;^TAGS:&quot;|wc -c`; if [ &quot;$istag&quot; -gt 0 ]; then tags=`echo $line|sed 's/TAGS: \\(.*\\)/\\1/g'`; echo $tags; fi; iskeyword=`echo $line|grep -E &quot;^KEYWORDS:&quot;|wc -c`; if [ &quot;$iskeyword&quot; -gt 0 ]; then let tagline=($i+1); fi; if [ &quot;$i&quot; == &quot;$tagline&quot; ]; then echo $tags; tags=&quot;&quot;; tagline=0; else echo $line; fi; done &gt; converted.txt</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.webzappr.com/2008/10/fix-moveable-type-export-with-metatag-tags-instead-of-keywords/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple way to get a diff to a server without subversion</title>
		<link>http://blog.webzappr.com/2008/10/simple-way-to-get-a-diff-to-a-server-without-subversion/</link>
		<comments>http://blog.webzappr.com/2008/10/simple-way-to-get-a-diff-to-a-server-without-subversion/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 21:29:53 +0000</pubDate>
		<dc:creator>Thorsten</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://snipplr.wordpress.com/2008/10/26/simple-way-to-get-a-diff-to-a-server-without-subversion/</guid>
		<description><![CDATA[I recently ran into the problem that I had to update the changes I made on my subversion sandbox to a shared hosting account.
In general you would just check out the revision you need or run a svn diff.
Sadly this is not only possible and you need to figure out the changed files which you [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ran into the problem that I had to update the changes I made on my subversion sandbox to a shared hosting account.</p>
<p>In general you would just check out the revision you need or run a svn diff.</p>
<p>Sadly this is not only possible and you need to figure out the changed files which you need to copy to the server.</p>
<p>This simple little command creates a tar archive with the changed files.</p>
<p><em>Note: you should be in the path of the checked out repository.</em></p>
<pre class="brush: php;">let revision_start=196; let revision_end=225; tar cfv ../r$revision_start-$revision_end.tar `svn diff -r $revision_start:$revision_end . | grep Index | awk '{print \$2}'`</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.webzappr.com/2008/10/simple-way-to-get-a-diff-to-a-server-without-subversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>lighttpd for image hosting</title>
		<link>http://blog.webzappr.com/2008/10/lighttpd-for-image-hosting/</link>
		<comments>http://blog.webzappr.com/2008/10/lighttpd-for-image-hosting/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 14:18:08 +0000</pubDate>
		<dc:creator>Thorsten</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lighttpd]]></category>

		<guid isPermaLink="false">http://snipplr.wordpress.com/2008/10/10/lighttpd-for-image-hosting/</guid>
		<description><![CDATA[In order to take some work of the webserver I recently installed a lighttpd server for delivery of static files.
The following tuning did the job (thanks to the video sharing script)
/etc/lighttpd/lighttpd.conf

server.max-keep-alive-requests = 4
server.max-keep-alive-idle = 4
server.event-handler = &#34;linux-sysepoll&#34;
server.network-backend = &#34;linux-sendfile&#34;
server.max-fds = 8192
server.stat-cache-engine = &#34;fam&#34;

/etc/sysctl.conf

# These ensure that TIME_WAIT ports either get reused or closed fast.
net.ipv4.tcp_fin_timeout = [...]]]></description>
			<content:encoded><![CDATA[<p>In order to take some work of the webserver I recently installed a lighttpd server for delivery of static files.</p>
<p>The following tuning did the job (thanks to <a href="http://www.videosharingscript.com/image-hosting/optimizing-lighttpd-for-image-hosting/trackback/" target="_blank">the video sharing script</a>)</p>
<p>/etc/lighttpd/lighttpd.conf</p>
<pre class="brush: css;">
server.max-keep-alive-requests = 4
server.max-keep-alive-idle = 4
server.event-handler = &quot;linux-sysepoll&quot;
server.network-backend = &quot;linux-sendfile&quot;
server.max-fds = 8192
server.stat-cache-engine = &quot;fam&quot;
</pre>
<p>/etc/sysctl.conf</p>
<pre class="brush: css;">
# These ensure that TIME_WAIT ports either get reused or closed fast.
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_tw_recycle = 1
# TCP memory
net.core.rmem_max = 16777216
net.core.rmem_default = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
# For Large File Hosting Servers
net.core.wmem_max = 1048576
net.ipv4.tcp_wmem = 4096 87380 524288
</pre>
<p>in the apache virtual host we just use proxy pass to forward our static urls to the lighttpd server running on port 8080</p>
<pre class="brush: css;">
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /images http://127.0.0.1:8080/images
ProxyPass /js http://127.0.0.1:8080/js
ProxyPass /css http://127.0.0.1:8080/css
ProxyPassReverse / http://127.0.0.1:8080/
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.webzappr.com/2008/10/lighttpd-for-image-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
