<?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>Marco&#039;s Webdev Notepad &#187; Serverstuff</title>
	<atom:link href="http://blog.t14g.de/index.php/archives/category/serverstuff/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.t14g.de</link>
	<description>My notepad of things webdev related.</description>
	<lastBuildDate>Mon, 23 Jan 2012 12:17:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Emulate sendmail on your Dev Machine</title>
		<link>http://blog.t14g.de/index.php/archives/1309</link>
		<comments>http://blog.t14g.de/index.php/archives/1309#comments</comments>
		<pubDate>Tue, 08 Feb 2011 07:18:38 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Serverstuff]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/?p=1309</guid>
		<description><![CDATA[In order to prevent email delivery during development and log all email messages that would have been delivered, you can actually do a simple trick: Replace the file /usr/sbin/sendmail (on Ubuntu, use &#8216;locate sendmail&#8217; to find it if it lies elsewhere) with this little shell-script, or rather make a _bak of the original and save [...]]]></description>
			<content:encoded><![CDATA[<p>In order to prevent email delivery during development and log all email messages that would have been delivered, you can actually do a simple trick: Replace the file /usr/sbin/sendmail (on Ubuntu, use &#8216;locate sendmail&#8217; to find it if it lies elsewhere) with this little shell-script, or rather make a _bak of the original and save the following instead of the sendmail binary:</p>
<pre>#!/bin/bash

LOGDIR="/tmp"
PREFIX="sendmail"
NOW=$(date +%Y-%m-%dT%H.%M.%S)
CNT=1
PRIVATELOG="$LOGDIR/$PREFIX-$NOW.$CNT.log"
COMBINEDLOG="$LOGDIR/$PREFIX-combined.log"

# If privatelogs are being used...
if [ ! -z "$PRIVATELOG" ]; then
# ...make sure the filename is unique and create the file
while [ -f $PRIVATELOG ]; do
CNT=$(($CNT + 1))
PRIVATELOG="$LOGDIR/$PREFIX-$NOW.$CNT.log"
done

echo "$0 $*" &gt; $PRIVATELOG
else
# ...otherwise swap filenames
PRIVATELOG=$COMBINEDLOG
COMBINEDLOG=''
fi

echo "[$NOW]" &gt;&gt; $PRIVATELOG
while read BUF
do
echo $BUF &gt;&gt; $PRIVATELOG
done

# Append privatelog to combinedlog when both logs are used
if [ ! -z "$COMBINEDLOG" ]; then
echo "[$NOW]" &gt;&gt; $COMBINEDLOG
cat $PRIVATELOG &gt;&gt; $COMBINEDLOG
fi

exit 0
</pre>
<p><strong>When your application now sends mail, these things happen:</strong></p>
<ul>
<li>No email is actually sent.</li>
<li>The message gets appended to the file /tmp/sendmail-combined.log, on which you could set a &#8216;tail -f&#8217; in order to see which emails would have been sent and what contet they would have.</li>
<li>One new file (e.g. /tmp/sendmail-2011-02-08T08.02.48.1.log) gets written for every email sent. I personally only use the combined file.</li>
</ul>
<p>Inspired by <a href="http://stackoverflow.com/questions/3710864/simulating-sendmail-with-dummy-script" target="_blank">http://stackoverflow.com/questions/3710864/simulating-sendmail-with-dummy-script</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/1309/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect all URLs to a Maintenance Page</title>
		<link>http://blog.t14g.de/index.php/archives/819</link>
		<comments>http://blog.t14g.de/index.php/archives/819#comments</comments>
		<pubDate>Fri, 17 Apr 2009 07:02:46 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Serverstuff]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/?p=819</guid>
		<description><![CDATA[Once in a while every bigger website is relaunched. In order to deploy bigger changes without bothering your visitors with strange behaviour during a data migration, updates and the like, you should use Apache2&#8242;s mod_rewrite. Just put the following lines in a .htaccess file in your webroot directory and all traffic (also deep links to [...]]]></description>
			<content:encoded><![CDATA[<p>Once in a while every bigger website is relaunched.</p>
<p>In order to deploy bigger changes without bothering your visitors with strange behaviour during a data migration, updates and the like, you should use Apache2&#8242;s mod_rewrite. Just put the following lines in a .htaccess file in your webroot directory and all traffic (also deep links to subdirectories) gets diverted to the maintenance-page. The scond line sets an exception for your IP address, so you are the only visitor who is NOT redirected to the mainteance page:</p>
<pre>RewriteEngine on
RewriteCond %{REMOTE_ADDR} !192\.168\.123\.101
RewriteRule !maintenance/index.html /maintenance/index.html [L,NC,R=301]</pre>
<p>Do not forget to remove the .htaccess file after you have finished your work!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/819/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reverse md5 Hash</title>
		<link>http://blog.t14g.de/index.php/archives/726</link>
		<comments>http://blog.t14g.de/index.php/archives/726#comments</comments>
		<pubDate>Thu, 05 Mar 2009 07:28:44 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Serverstuff]]></category>
		<category><![CDATA[cli]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/?p=726</guid>
		<description><![CDATA[Here is a link of a site (www.md5.rednoize.com) that performs a search on common md5 hashes &#8211; in case you forgot your standard password: Make yourself a md5-hash using PHP ;) to test it: marco@africa:~$ php -r 'echo md5("marco")."\n";' f5888d0bb58d611107e11f7cbc41c97a]]></description>
			<content:encoded><![CDATA[<p>Here is a link of a site (<a href="http://www.md5.rednoize.com/" target="_blank">www.md5.rednoize.com</a>) that performs a search on common md5 hashes &#8211; in case you forgot your standard password:</p>
<p><a href="http://www.md5.rednoize.com/" target="_blank"><img class="alignnone size-medium wp-image-728" style="border: 1px solid black;" title="md5 hash reverted" src="http://blog.t14g.de/wp-content/uploads/2009/03/md5-300x159.jpg" alt="md5 hash reverted" width="300" height="159" /></a></p>
<p>Make yourself a md5-hash using PHP ;) to test it:<br />
<code><br />
marco@africa:~$ php -r 'echo md5("marco")."\n";'<br />
f5888d0bb58d611107e11f7cbc41c97a<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/726/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade PHP5 with an alternative sources.list on Debian etch</title>
		<link>http://blog.t14g.de/index.php/archives/671</link>
		<comments>http://blog.t14g.de/index.php/archives/671#comments</comments>
		<pubDate>Fri, 20 Feb 2009 11:22:26 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Problems]]></category>
		<category><![CDATA[Serverstuff]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/?p=671</guid>
		<description><![CDATA[I was having trouble with a server running Debian 4.0 (etch). Using the standard sources in the /etc/apt/sources.list the supported PHP5 version was 5.2.0-8+etch13 which contained a very annoying bug for my application. A daily running script &#8211; let&#8217;s call it the Importer &#8211; regularly exited randomly with a &#8220;Fatal error: Out of memory (allocated [...]]]></description>
			<content:encoded><![CDATA[<p>I was having trouble with a server running Debian 4.0 (etch). Using the standard sources in the /etc/apt/sources.list the supported PHP5 version was 5.2.0-8+etch13 which contained a very annoying bug for my application.</p>
<p>A daily running script &#8211; let&#8217;s call it the Importer &#8211; regularly exited randomly with a &#8220;Fatal error:  Out of memory (allocated 12320768) (tried to allocate 2851436 bytes) in &#8230;&#8221; and I had to restart it manually nearly every morning. I had&#8230;</p>
<ul>
<li>&#8230;checked my application for memory wasting operations and loops and fixed them,</li>
<li>&#8230;used ini_set(&#8216;memory_limit&#8217;, &#8217;64M&#8217;); at runtime, and</li>
<li>&#8230;finally increased memory_limit = 64M in my php.ini.</li>
</ul>
<p>But all this did not change the bahaviour of the Importer!</p>
<p>So I took a look at the <a href="http://www.php.net/ChangeLog-5.php" target="_blank">PHP5 Changelog</a> to find potentially fixed bugs in newer releases. Bug <a href="http://bugs.php.net/bug.php?id=39438" target="_blank">#39438</a> described exactly my problem. So a simple upgrade would help me. But it did not work with &#8216;apt-get upgrade&#8217; or &#8216;apt-get install php5=5.2.8&#8242; since the highest version in the apt source I used was the one that I already had: 5.2.0-8+etch13, issued in November 2006&#8230; (pretty ancient)</p>
<p>Finally it was <a href="http://www.dotdeb.org/instructions/" target="_blank">this page</a> that had the information we needed: <strong>an alternative apt source</strong></p>
<p><code>deb http://packages.dotdeb.org etch all<br />
deb-src http://packages.dotdeb.org etch all<br />
</code></p>
<p>After getting an impression whether <a href="http://www.dotdeb.org/about/" target="_blank">dotdeb</a> was a trustworthy source, we first tried it on our dev-system with &#8216;apt-get update; apt-get upgrade;&#8217;. At this point I was once more glad to have written so many UnitTests. They all passed and everything looked good.</p>
<p>Thanks Kim for your help!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/671/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Save Serialized Objects to MySql</title>
		<link>http://blog.t14g.de/index.php/archives/391</link>
		<comments>http://blog.t14g.de/index.php/archives/391#comments</comments>
		<pubDate>Wed, 19 Nov 2008 18:31:40 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Problems]]></category>
		<category><![CDATA[Serverstuff]]></category>
		<category><![CDATA[mySQL]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/?p=391</guid>
		<description><![CDATA[I have just discovered an issue if you store serialized objects into MySql. At first I used fieldtype TEXT. If in this case somebody edited another field of such a record with phpMyAdmin and pushed the save button, the stored object in that record got currupted and the object could not be deserialized and instanciated [...]]]></description>
			<content:encoded><![CDATA[<p>I have just discovered an issue if you store serialized objects into MySql.</p>
<p>At first I used fieldtype TEXT. If in this case somebody edited another field of such a record with phpMyAdmin and pushed the save button, the stored object in that record got currupted and the object could not be deserialized and instanciated anymore.</p>
<p>We now use the fieldtype BLOB instead, so phpMyAdmin does not give you the chance to edit the fieldcontent. And it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/391/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CMS Redirects to 404 Pages for Dead Links</title>
		<link>http://blog.t14g.de/index.php/archives/371</link>
		<comments>http://blog.t14g.de/index.php/archives/371#comments</comments>
		<pubDate>Fri, 14 Nov 2008 18:13:05 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Problems]]></category>
		<category><![CDATA[Serverstuff]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[http]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/?p=371</guid>
		<description><![CDATA[I have an individual CMS running for a customer, who can edit his events, news etc. in a typical admin area. Each of the items had an expiry date. On any call to a deep URL to one of the expired items (e.g. from Google search results) it would make a redirect to the custom [...]]]></description>
			<content:encoded><![CDATA[<p>I have an individual CMS running for a customer, who can edit his events, news etc. in a typical admin area. Each of the items had an expiry date. On any call to a deep URL to one of the expired items (e.g. from Google search results) it would make a redirect to the custom 404-page like this:<br />
<code><br />
header("Location: http://www.mycusweb.de/errors/404.php");<br />
exit;<br />
</code></p>
<p>The 404-Page itself would then respond with its own 404 header and display a beautiful error page.</p>
<p>As I found out, this would NOT have the effect that I expected it to have, namely that the next Google bot crawling these URLs would kill the URL from the index since it ended up on a proper 404 page via the redirect. The headers in sequence with the above redirect look like this:<br />
<code><br />
GET /pages/events.php?id=123 HTTP/1.1<br />
HTTP/1.x 302 Found<br />
GET /errors/404.php<br />
HTTP/1.1 HTTP/1.x 404 Not Found<br />
</code></p>
<p>But wait, there is 302. To verify this for your own redirects, you can use the Firefox add-on <a href="https://addons.mozilla.org/addon/3829" target="_blank">Live HTTP Headers</a>.</p>
<p>The problem here is the use of a default redirect, which uses a status code &#8217;302 Found&#8217;. This equals the old &#8217;307 Temporary Redirect&#8217; and has the meaning for the bot, something hast just temporarily moved. In order to &#8216;tell&#8217; the bot that this page should no longer be indexed and deleted, you must use a &#8217;301 Moved Permanently&#8217; and you do it like this:<br />
<code><br />
header("HTTP/1.1 301 Moved Permanently");<br />
header("Location: http://www.mycusweb.de/errors/404.php");<br />
exit;<br />
</code></p>
<p>If you&#8217;re interested in the HTTP status codes, you can find the RFCs <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" target="_blank">here</a>.</p>
<p>After all of your redirects that should &#8216;tell&#8217; bots to remove URLs from the search index use the 301 variant, you can then use the <a href="https://www.google.com/webmasters/tools/removals" target="_blank">Google Remove Tool</a> to speed things up and call the bot.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/371/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Start longer running Jobs with screen</title>
		<link>http://blog.t14g.de/index.php/archives/188</link>
		<comments>http://blog.t14g.de/index.php/archives/188#comments</comments>
		<pubDate>Thu, 19 Jun 2008 06:32:41 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Serverstuff]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/?p=188</guid>
		<description><![CDATA[On the command line if you close a console with a running job, you kill the job. This is different with the tool &#8216;screen&#8217;, where you can attach and detach from a &#8216;screen&#8217; without terminating it. You can even start a job in a screen on another machine, detatch, travel somewhere else and re-attach to [...]]]></description>
			<content:encoded><![CDATA[<p>On the command line if you close a console with a running job, you kill the job. This is different with the tool &#8216;screen&#8217;, where you can attach and detach from a &#8216;screen&#8217; without terminating it. You can even start a job in a screen on another machine, detatch, travel somewhere else and re-attach to it on another machine.</p>
<p>If you do not have screen yet, install it on your Debian box with: <em>apt-get install screen</em></p>
<p>Commands:</p>
<ul>
<li><strong>screen -S indexing</strong> &#8211; Create a screen with name &#8216;indexing&#8217;.</li>
<li><strong>screen -ls</strong> &#8211; Show available screens.</li>
<li><strong>screen -r indexing</strong> &#8211; Re-attach to the screen &#8216;indexing&#8217;.</li>
<li><strong>Strg-A, Strg-D</strong> &#8211; Detatch from a current screen (without terminating it).</li>
<li><strong>exit OR </strong><strong>Strg-D</strong> &#8211; Exit from a current screen. This terminates the screen session.<strong><br />
</strong></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/188/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trigger and Organize Timed Tasks with &#8216;at&#8217;</title>
		<link>http://blog.t14g.de/index.php/archives/187</link>
		<comments>http://blog.t14g.de/index.php/archives/187#comments</comments>
		<pubDate>Thu, 29 May 2008 08:22:56 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Serverstuff]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/?p=187</guid>
		<description><![CDATA[Since I am doing more and more stuff on the commandline, I noticed that sometimes I just wait for some task to finish to do a next step in a sequence to accomplish a certain goal. What if a running task would take an estimated 3-8 hours and it is Friday afternoon? In this case [...]]]></description>
			<content:encoded><![CDATA[<p>Since I am doing more and more stuff on the commandline, I noticed that sometimes I just wait for some task to finish to do a next step in a sequence to accomplish a certain goal. What if a running task would take an estimated 3-8 hours and it is Friday afternoon?</p>
<p>In this case you can use the commandline-tool &#8216;at&#8217; and schedule something like &#8216;at 1am tomorrow do xyz&#8217;.</p>
<p>If you do not have at yet, install it on your Debian box with: <em>apt-get install at</em></p>
<p>There are 3 commands available:</p>
<ul>
<li><strong>at &lt;datetime&gt;</strong> &#8211; Starts the scheduling-dialog for a specific date or/and time to execute certain commands.</li>
<li><strong>atq</strong> &#8211; Shows a list of already scheduled and pending jobs.</li>
<li><strong>atrm &lt;job-id&gt;</strong> &#8211; Deletes pending jobs you would like to remove from the job-queue.</li>
</ul>
<p><span style="text-decoration: underline;"><strong>Case:</strong> What do you have to do in order to set a sequence of commands as root at a specific time?</span></p>
<p>Let&#8217;s say it is Friday 15:00h (and the server-clock says that too) and you would like to fire the command</p>
<ul>
<li>echo &#8220;Good morning!&#8221; &gt; hello.txt @ 08:00h tomorrow</li>
</ul>
<p>You would do the following:</p>
<ul>
<li>Log in as root.</li>
<li>Type &#8216;at 8.00&#8242; &lt;enter&gt;.</li>
<li>Since for today 08.00 is already in the past, at assumes that you mean tomorrow. But you can use all sorts of time- and date signatures, for example you could use &#8216;at 08:00 01.06.2008&#8242;.</li>
<li>Now the prompt changes to <strong>at&gt;</strong> and waits for your commands to be executed sequentially at the time you specified.</li>
<li>Now you type your first command to be executet: &#8216;cd ~/stuff&#8217; &lt;enter&gt; &#8211; to make sure where the next command is executed, since it writes a file.</li>
<li>Now type your 2nd command: &#8216;echo &#8220;Hello 8.00&#8243; &gt; hello.txt&#8217; &lt;enter&gt;</li>
<li>The prompt shows another <strong>at&gt;</strong>. If you have more commands add them. In our example we have only two. To finish we press <strong>STRG-D</strong> and you have your normal prompt back.</li>
<li>Type the command &#8216;atq&#8217; to see the pending jobs in the queue. Your job, you just added has a job-ID in the first column.</li>
<li>To delete the job from the queue type &#8216;atrm &lt;job-id&gt;&#8217;.</li>
</ul>
<p>Good timing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/187/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mount Terastation on Debian Linux</title>
		<link>http://blog.t14g.de/index.php/archives/100</link>
		<comments>http://blog.t14g.de/index.php/archives/100#comments</comments>
		<pubDate>Sun, 23 Dec 2007 22:37:08 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Serverstuff]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/index.php/archives/100</guid>
		<description><![CDATA[On my network I have a Buffalo Terastation as network-share for backups. Today I figured out how to mount it on another Linux-box (Debian Etch) so I could do file operations directly on my backup. The following worked out for me: Created dir /mnt/terastation2 Added the following line to /etc/fstab //TERASTATION2/SHARE /mnt/terastation2 smbfs username=marco,password=,uid=marco,gid=businex,dmask=707,fmask606 And [...]]]></description>
			<content:encoded><![CDATA[<p>On my network I have a <a href="http://www.buffalo-technology.com/products/network-storage/terastation/terastation-pro-ii/" target="_blank">Buffalo Terastation</a> as network-share for backups. Today I figured out how to mount it on another Linux-box (Debian Etch) so I could do file operations directly on my backup. The following worked out for me:</p>
<ul>
<li>Created dir /mnt/terastation2</li>
<li>Added the following line to /etc/fstab<br />
//TERASTATION2/SHARE /mnt/terastation2 smbfs username=marco,password=,uid=marco,gid=businex,dmask=707,fmask606</li>
<li>And executed<br />
mount -a<br />
as root.</li>
</ul>
<p>If you like to mount it only once in an while, you can also do it via the command:</p>
<ul>
<li>smbmount //TERASTATION2/share /mnt/terastation2 -o lfs<br />
You need to have smbmount installed.</li>
</ul>
<p>Both should have the effect that you can access the Terastation on /mnt/terastation2. No more Windows clients involved for copying files around.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/100/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Podcast: Run Your Own Server</title>
		<link>http://blog.t14g.de/index.php/archives/46</link>
		<comments>http://blog.t14g.de/index.php/archives/46#comments</comments>
		<pubDate>Wed, 11 Jul 2007 09:39:10 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Podcasts]]></category>
		<category><![CDATA[Serverstuff]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/index.php/archives/46</guid>
		<description><![CDATA[Goto: http://www.runyourownserver.org]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.runyourownserver.org/" target="_blank">Goto: http://www.runyourownserver.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/46/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Organize remote backups with rsnapshot</title>
		<link>http://blog.t14g.de/index.php/archives/30</link>
		<comments>http://blog.t14g.de/index.php/archives/30#comments</comments>
		<pubDate>Wed, 13 Jun 2007 12:06:24 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[Serverstuff]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.t14g.de/index.php/archives/30</guid>
		<description><![CDATA[If you have some customer projects running on webservers (must be accessible to you via ssh) and you would like to regularly backup critical data like mySQL databases or filestructures this post might be useful for you. All you need is a linux box connected to the internet. (1) Take a look at rsnapshot: http://www.howtoforge.de/rsync_incremental_snapshot_backups [...]]]></description>
			<content:encoded><![CDATA[<p>If you have some customer projects running on webservers (must be accessible to you via ssh) and you would like to regularly backup critical data like mySQL databases or filestructures this post might be useful for you. All you need is a linux box connected to the internet.</p>
<p><strong> (1)</strong></p>
<ul>
<li>Take a look at rsnapshot: <a href="http://www.howtoforge.de/rsync_incremental_snapshot_backups" target="_blank">http://www.howtoforge.de/rsync_incremental_snapshot_backups</a></li>
<li>Install rsnapshot on your box following the above tutorial.</li>
<li>Decide for a place for your snapshot-backups on the filesystem and edit /etc/rsnapshot.conf accordingly. I use /var/remotebackups.</li>
<li>Take a look at the example zip-file (<a href="http://blog.t14g.de/wp-content/uploads/2007/07/remotebackups2.zip" title="Remotebackups example for mySQL and files">Download: remotebackups example for mySQL and files</a>). Files should be copied to your backup-dir /var/remotebackups (except of /etc/rsnapshot.conf).</li>
</ul>
<p><strong>(2)</strong></p>
<ul>
<li>Shellscripts in /var/remotebackups/_scripts retrieve mySQL-dumps etc. from remote servers and store it in the scripts&#8217; own data/ directory.</li>
<li>Those fetch-scripts can be triggered manually or all together via /var/remotebackups/_scripts/_execute_all_scripts.sh.<br />
Example: <a href="http://blog.t14g.de/wp-content/uploads/2007/06/fetch_dumpsh.txt" target="_blank" title="Example fetch-script">fetch-script.</a></li>
<li>Scripts must be executed as root or with sudo.</li>
<li>Access via scp or ssh to other machines pops up a password dialogue. To prevent this, setup passphraseless keys using the /&lt;user&gt;/.ssh/authorized_keys file on the remote machines and check it by executing something like this without being asked for a password:<br />
<em> ssh &lt;remote_user&gt;@&lt;remotemachine_or_ip_adr&gt; &#8220;cd ~; pwd;&#8221;</em><br />
This should show you the path to the home directory of &lt;remote_user&gt;<br />
The howtoforge-page in the head of this file shows you how to do passphraseless authentication.</li>
</ul>
<p><strong>(3)</strong></p>
<ul>
<li> The command &#8220;rsnapshot roundrobin&#8221; later triggers the roundrobin backup defined in /etc/rsnapshot.conf. All above data is then saved to a new slot in /var/remotebackups/roundrobin.0-9/&#8230;.<br />
WARNING: Always execute data aggregation scripts to have a current version of data in each backup-dir prior to executing rsnapshot! Otherwise old data will be saved in a roundrobin slot. The easiest way to do all together is to just execute /var/remotebackups/_scripts/_execute_all_scripts.sh. I do it manually whenever I feel like needing a backup ;). You can easily automate backups using cron.</li>
<li>In order to be able to save your snapshots to the 10 mentioned &#8217;roundrobin&#8217;-slots of rsnapshot you need this line in your rsnapshot.conf<br />
interval&lt;tab&gt;roundrobin&lt;tab&gt;10</li>
<li>I set a symbolic link from the actual conf-file /etc/rsnapshot.conf to have it all together in /var/remotebackups using this command<br />
<em> ln -s /etc/rsnapshot.conf /var/remotebackups/</em></li>
</ul>
<p><strong>(4)</strong></p>
<ul>
<li>To add a new backup do the following:<br />
(a) Create a dir below /var/remotebackups/_scripts like businex_mysql_blog_synergieraum including a fetch-script like fetch_dump.sh and a data-directory.<br />
(b) Edit the fetch_dump.sh-script with credentials so it copies whatever you would like to backup into the data-directory.<br />
(c) Add the reference to the new fetch-script in /var/remotebackups/_scripts/_execute_all_scripts.sh in order to have a central triggering script.<br />
(d) Add the new backup data-directory to your rsnapshot.conf.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.t14g.de/index.php/archives/30/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

