<?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>Blog dot Melimato dot Com &#187; server</title>
	<atom:link href="http://blog.melimato.com/category/server/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.melimato.com</link>
	<description>Those things we do</description>
	<lastBuildDate>Fri, 29 Jul 2011 09:24:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Restoring readline capabilities of Ubuntu&#8217;s 9.10 (Karmic Koala) MySQL client</title>
		<link>http://blog.melimato.com/restoring-readline-capabilities-of-ubuntus-9-10-karmic-koala-mysql-client/</link>
		<comments>http://blog.melimato.com/restoring-readline-capabilities-of-ubuntus-9-10-karmic-koala-mysql-client/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 11:58:58 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql command line]]></category>
		<category><![CDATA[readline]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/?p=227</guid>
		<description><![CDATA[I recently updated to the newest version, 9.10 AKA Karmic Koala and I love it. It&#8217;s fast and everything works perfectly. Or nearly everything&#8230; The one thing that really annoyed me in this version was the MySQL terminal. All of a sudden after the upgrade ctrl+r for reverse search didn&#8217;t work anymore. And there was [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Frestoring-readline-capabilities-of-ubuntus-9-10-karmic-koala-mysql-client%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Frestoring-readline-capabilities-of-ubuntus-9-10-karmic-koala-mysql-client%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I recently updated to the <a href="http://www.ubuntu.com/">newest version, 9.10 AKA Karmic Koala</a> and I love it. It&#8217;s fast and everything works perfectly. Or nearly everything&#8230;</p>
<p><span id="more-227"></span></p>
<p>The one thing that really annoyed me in this version was the MySQL terminal. All of a sudden after the upgrade ctrl+r for reverse search didn&#8217;t work anymore. And there was more&#8230;delete didn&#8217;t work either and esc+backspace was behaving weirdly too. Unfortunately I did not have time to look for a solution because of my work load. But then xmas came and here I am, stuck at home with the family, giving me a lot of time to research about those things that were very low on my priorities list. And I found a solution!</p>
<p>It seems that Ubuntu replaced <a href="http://utopia.knoware.nl/~hlub/uck/rlwrap/">libreadline</a> with <a href="http://thrysoee.dk/editline/">libedit</a>. And <a href="http://utopia.knoware.nl/~hlub/uck/rlwrap/">readline</a> is the library that provides all those cool command line capabilities. So let&#8217;s enable it again, but instead of compiling the whole thing again, let&#8217;s just use a wrapper, the <a href="http://freshmeat.net/projects/rlwrap/">readline wrapper</a>!</p>
<p>First, let&#8217;s install it:</p>

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

<p>That&#8217;s it! Now all we need to do is to start mysql command line interface through rlwrap:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rlwrap <span style="color: #660033;">-a</span> mysql <span style="color: #660033;">-uUSER</span> <span style="color: #660033;">-pPASSWORD</span> DBNAME</pre></div></div>

<p>To make things easier, let&#8217;s create an alias in our bashrc file.</p>

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

<p>And add the alias:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">mysql</span>=<span style="color: #ff0000;">'rlwrap -a mysql'</span></pre></div></div>

<p>Credit: <a href="http://ubuntuforums.org/showthread.php?t=1147183">http://ubuntuforums.org/showthread.php?t=1147183</a></p>
<div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/restoring-readline-capabilities-of-ubuntus-9-10-karmic-koala-mysql-client/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Configuring a shared repository in Bazaar for users with no shell access</title>
		<link>http://blog.melimato.com/configuring-a-shared-repository-in-bazaar-for-users-with-no-shell-access/</link>
		<comments>http://blog.melimato.com/configuring-a-shared-repository-in-bazaar-for-users-with-no-shell-access/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 13:07:11 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[bzr]]></category>
		<category><![CDATA[bazaar]]></category>
		<category><![CDATA[bzr central model]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[vcs]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/?p=208</guid>
		<description><![CDATA[One of the things that stumbled me the most about bazaar is that it does not have a own authentication method. Users can access repositories through ssh, sftp, etc. While this is very usefull if everyone working on the repo has shell access to the server, it does not allow &#8220;virtual users&#8221; the way svn [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fconfiguring-a-shared-repository-in-bazaar-for-users-with-no-shell-access%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fconfiguring-a-shared-repository-in-bazaar-for-users-with-no-shell-access%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>One of the things that stumbled me the most about <a href="http://bazaar-vcs.org">bazaar</a> is that it does not have a own authentication method. Users can access repositories through ssh, sftp, etc. While this is very usefull if everyone working on the repo has shell access to the server, it does not allow &#8220;virtual users&#8221; the way svn does. Well, not out of the box anyway&#8230; There&#8217;s always a workaround. This post tries to explain how to configure Bazaar in the <a href="http://doc.bazaar-vcs.org/latest/en/user-guide/central_intro.html">centralized model</a> and set user level permissions to the working directory.</p>
<p><span id="more-208"></span></p>
<h2>Setup initial repository on server</h2>
<p>Init central repository with no working trees, since no-one is going to be committing in the central server. I&#8217;m calling it bzr_test.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>repo<span style="color: #000000; font-weight: bold;">/</span>base
user<span style="color: #000000; font-weight: bold;">@</span>server$ bzr init-repo <span style="color: #660033;">--no-trees</span> bzr_test</pre></div></div>

<p>Init first branch (trunk) on newly created repo:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>server$ bzr init bzr_test<span style="color: #000000; font-weight: bold;">/</span>trunk</pre></div></div>

<h2>Securing with bzr_access on server</h2>
<p> (<a href="http://bazaar-vcs.org/BzrAccess">http://bazaar-vcs.org/BzrAccess</a>)</p>
<p>Firstly, get the bzr sources from launchpad, unpack it and copy the bzr_access script located in the contrib directory to some path, I usually use /usr/local/sbin.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp
user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>launchpad.net<span style="color: #000000; font-weight: bold;">/</span>bzr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2.0</span><span style="color: #000000; font-weight: bold;">/</span>2.0.1<span style="color: #000000; font-weight: bold;">/</span>+download<span style="color: #000000; font-weight: bold;">/</span>bzr-2.0.1.tar.gz
user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxfv bzr-2.0.1.tar.gz
user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #7a0874; font-weight: bold;">cd</span> bzr-2.0.1
user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #c20cb9; font-weight: bold;">cp</span> contrib<span style="color: #000000; font-weight: bold;">/</span>bzr_access <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>bzr_access</pre></div></div>

<p>or</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>bazaar-vcs.org<span style="color: #000000; font-weight: bold;">/</span>bzr<span style="color: #000000; font-weight: bold;">/</span>bzr.dev.knits<span style="color: #000000; font-weight: bold;">/</span>contrib<span style="color: #000000; font-weight: bold;">/</span>bzr_access <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>bzr_access</pre></div></div>

<p>And make sure the script is executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>bzr_access</pre></div></div>

<p>Then, add a system user to be used to access the repository:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> adduser \
    <span style="color: #660033;">--system</span> \
    <span style="color: #660033;">--shell</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">sh</span> \
    <span style="color: #660033;">--gecos</span> <span style="color: #ff0000;">'bzr version control'</span> \
    <span style="color: #660033;">--group</span> \
    <span style="color: #660033;">--disabled-password</span> \
    <span style="color: #660033;">--home</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>repo \
    bzr_username</pre></div></div>

<p>Once you created the system user, create a .ssh dir in the user&#8217;s home directory (I use the repository&#8217;s root)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~bzr_username<span style="color: #000000; font-weight: bold;">/</span>.ssh
user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #c20cb9; font-weight: bold;">vi</span> ~bzr_username<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys</pre></div></div>

<p>And add the following line (one per user) to the user&#8217;s authorized_keys file:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"># ~bzr_username/.ssh/authorized_keys
<span style="color: #000099;">command</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;/path/to/bzr_access /path/to/bzr /path/to/repo username&quot;</span>,no-port-forwarding,no-X11-forwarding,no-agent-forwarding CLIENT_PUBLIC_KEY</pre></div></div>

<p><em>Parameters</em>:<br />
<strong>/path/to/bzr_access</strong> = /usr/local/sbin/bzr_access<br />
<strong>/path/to/bzr</strong>: Can be found by executing <em>whereis bzr</em>. Usually in /usr/bin/bzr<br />
<strong>/path/to/repo</strong>: /home/development/bzr/bzr_test bzr<br />
<strong>username</strong>: bzr_username<br />
<strong>CLIENT_PUBLIC_KEY</strong>: is the client&#8217;s public key found in ~/.ssh/id_rsa.pub on the client&#8217;s machine</p>
<p>Now, you need to add a bzr_access.conf file to your repo&#8217;s root:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>server$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>repo<span style="color: #000000; font-weight: bold;">/</span>bzr_access.conf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"># /path/to/repo/bzr_access.conf
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>groups<span style="">&#93;</span></span>
<span style="color: #000099;">admins</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> admin1</span>
<span style="color: #000099;">devels</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> user1, user2, user3</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>/<span style="">&#93;</span></span>
@admins <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> rw</span>
@devels <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> r</span></pre></div></div>

<p>OK! Your repo is initted and secured! User admin1 is an admin and cat read &#038; write to the repo while user1, user2 and user3 are devels and have only read access.</p>
<h2>Checkout or branch the repository on the client</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>client$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> bzr_test
user<span style="color: #000000; font-weight: bold;">@</span>client$ <span style="color: #7a0874; font-weight: bold;">cd</span> bzr_test
user<span style="color: #000000; font-weight: bold;">@</span>client$ bzr <span style="color: #c20cb9; font-weight: bold;">co</span> bzr+<span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>bzr_username<span style="color: #000000; font-weight: bold;">@</span>melimato.com<span style="color: #000000; font-weight: bold;">/</span>trunk my_checkedout_trunk
user<span style="color: #000000; font-weight: bold;">@</span>client$ bzr branch bzr+<span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>bzr_username<span style="color: #000000; font-weight: bold;">@</span>melimato.com<span style="color: #000000; font-weight: bold;">/</span>trunk my_branch</pre></div></div>

<h2>Limitations</h2>
<p>Taken from <a href="http://bazaar-vcs.org/BzrAccess">http://bazaar-vcs.org/BzrAccess</a></p>
<blockquote>
<p>Currently, each bzr_access.conf configuration file is limited to specifying the access control for the directory that it is in. As such, to cater for a setup with multiple projects that should be segregated, one must either</p>
<p>Create a user account for each project, thus duplicating the configuration for each user account but allowing each user to maintain just one SSH key pair.</p>
<p>Create a single user account, but require each user to have an SSH key pair for each project. They will then have to select the appropriate private key to access the desired directory. Each of these directories will have its own bzr_access.conf, but there need be only one authorized_keys file.</p>
<p>Create an SSH key pair for each project and have users share private keys. However, removing the access of a user from a given directory will mean revoking a key pair and issuing a new private key to the other users with access to that directory.</p>
</blockquote>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://blog.melimato.com/restore-uncompress-a-plesk-backup-file-using-terminal/" rel="bookmark" class="wherego_title">Restore / uncompress a plesk backup file using terminal</a></li><li><a href="http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/" rel="bookmark" class="wherego_title">Set new logrotate tasks to rotate apache logs in non-standard directories</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/configuring-a-shared-repository-in-bazaar-for-users-with-no-shell-access/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Restore / uncompress a plesk backup file using terminal</title>
		<link>http://blog.melimato.com/restore-uncompress-a-plesk-backup-file-using-terminal/</link>
		<comments>http://blog.melimato.com/restore-uncompress-a-plesk-backup-file-using-terminal/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 16:51:00 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[Plesk]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[compress]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[mpack]]></category>
		<category><![CDATA[restore]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/?p=190</guid>
		<description><![CDATA[Today I was had to move a few web sites from one server to another. As I did not have ssh or ftp access to it, the only way to do it was through Plesk. As I don&#8217;t have experience using Plesk, I did not know that Plesk&#8217;s built in File Explorer can only be [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Frestore-uncompress-a-plesk-backup-file-using-terminal%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Frestore-uncompress-a-plesk-backup-file-using-terminal%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Today I was had to move a few web sites from one server to another. As I did not have ssh or ftp access to it, the only way to do it was through <a href="http://www.parallels.com/es/products/plesk/">Plesk</a>. As I don&#8217;t have experience using Plesk, I did not know that Plesk&#8217;s built in File Explorer can only be used to manage your web site&#8217;s files within the server, but it does not let you download those files. So, looking around Plesk&#8217;s admin interface I found the backup feature. That looked promissing, so I clicked on it and it brought me to another page called &#8220;Backup Manager&#8221;. This page allows you to set up periodic or one time backups. Backups can be saved in Plesk&#8217;s local repository or in an external FTP server. So I set up all the FTP details and start the backup. Once the backup finished I tried to open it on a linux box and file-roller gave an error when it tried to extract it. A `file` showed that the file was indeed in gzip format.</p>
<p><span id="more-190"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">file</span> mydomain.com_2009.11.02_13.07
mydomain.com_2009.11.02_13.07: <span style="color: #c20cb9; font-weight: bold;">gzip</span> compressed data, from Unix, <span style="color: #c20cb9; font-weight: bold;">last</span> modified: Mon Nov  <span style="color: #000000;">2</span> <span style="color: #000000;">13</span>:08:<span style="color: #000000;">11</span> <span style="color: #000000;">2009</span></pre></div></div>

<p>Being a gzip file I obviously tried to gunzip it, but again no luck</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">gunzip</span> mydomain.com_2009.11.02_13.07
<span style="color: #c20cb9; font-weight: bold;">gunzip</span> mydomain.com_2009.11.02_13.07
<span style="color: #c20cb9; font-weight: bold;">gzip</span>: mydomain.com_2009.11.02_13.07: unknown suffix <span style="color: #660033;">--</span> ignored</pre></div></div>

<p>After googling around for a quite a while I did not find out what this &#8220;unknown suffix&#8221; error meant, but instead I found on the <a href="http://kb.parallels.com/en/1757">Parallels Knowledge Base</a> how to do it. I&#8217;m copying/pasting it below for future reference:</p>
<blockquote><p>
II. SECOND WAY:</p>
<p>It can be done using mpack tools to work with MIME files. This packet is included into Debian:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># apt-get install mpack</span></pre></div></div>

<p>For other Linux systems you can try to use RPM from ALT Linux:<br />
ftp://ftp.pbone.net/mirror/ftp.altlinux.ru/pub/distributions/ALTLinux/Sisyphus/files/i586/RPMS/mpack-1.6-alt1.i586.rpm<br />
or compile mpack from the sources: http://ftp.andrew.cmu.edu/pub/mpack/.<br />
 &#8211; Create an empty directory to extract the back up file:<br />
# mkdir recover<br />
# cd recover</p>
<p>and copy backup into it. By default Plesk backup is gzipped (if not, use cat), so run zcat to pass data to munpack to extract content  of directories from the backup file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># zcat DUMP_FILE.gz &gt; DUMP_FILE </span>
<span style="color: #666666; font-style: italic;"># cat DUMP_FILE | munpack</span></pre></div></div>

<p> In result you get the set of tar and sql files that contain domains&#8217; directories and databases. Untar the needed directory. For example if you need to restore the httpdocs folder for the DOMAIN.TLD domain:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># tar xvf DOMAIN.TLD.htdocs</span></pre></div></div>

</blockquote>
<p>That did it, after untaring the htdocs file I finnaly got what I wanted. Hope that saves someone some time.</p>
<div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/restore-uncompress-a-plesk-backup-file-using-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ignored files in Bazaar in a Symfony project</title>
		<link>http://blog.melimato.com/ignored-files-in-bazaar-in-asymfony-project/</link>
		<comments>http://blog.melimato.com/ignored-files-in-bazaar-in-asymfony-project/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:40:19 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[bzr]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[bazaar]]></category>
		<category><![CDATA[bzrignore]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[vcs]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/?p=164</guid>
		<description><![CDATA[Recently, I&#8217;ve been doing a few projects using Symfony PHP framework and Bazaar for version control. One of the great features of Symfony is that it generates base classes automatically to interact with the database from a pre-defined schema file. While this is a great feature, every time the schema gets changed, Symfony regenerates all [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fignored-files-in-bazaar-in-asymfony-project%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fignored-files-in-bazaar-in-asymfony-project%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Recently, I&#8217;ve been doing a few projects using <a href="http://www.symfony-project.org/">Symfony</a> PHP framework and <a href="http://bazaar-vcs.org/en/">Bazaar</a> for version control. One of the great features of Symfony is that it generates base classes automatically to interact with the database from a pre-defined  schema file. While this is a great feature, every time the schema gets changed, Symfony regenerates all the files thus flagging them as modified in Bazaar. To avoid committing those files all the time, I created a .bzrignore file to ignore them and leave my repository nice and clean.</p>
<p><span id="more-164"></span></p>
<p>Firstly, init bazaar for your new project:</p>

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

<p>Next edit your .bzrignore file located in the root dir of your project</p>

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

<p>And add the following lines:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">trunk<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/*</span>schema-transformed.xml
trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.<span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>The above lines are pretty much self-explanatory, the only important thing here to keep in mind is that if you want to ignore all the files inside a directory you firstly have to add the directory to bazaar (bzr add dir) and then ignore everything inside them.<br />
The magic really happens in the following line.<br />
For Doctrine users:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">trunk<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/**/</span>base<span style="color: #000000; font-weight: bold;">/*</span></pre></div></div>

<p>And Propel</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">**/</span>om<span style="color: #000000; font-weight: bold;">/*</span>. 
 <span style="color: #000000; font-weight: bold;">**/</span>map<span style="color: #000000; font-weight: bold;">/*</span>.</pre></div></div>

<p>This tells bzr to ignore anything inside any directory named base inside the lib directory, and om and map if you&#8217;re using propel, which is where all base classes are stored. </p>
<p>This way, your repository will only store the files that you edit. All files generated automatically by Symfony or plugins are ignored, so when checking out a Symfony project you will have to execute:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>symfony doctrine-build-all</pre></div></div>

<p>or</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>symfony propel-build-all</pre></div></div>

<p>To see which files are currently being ignored use the following command:</p>

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

<p>And the output should be something like this:</p>
<p>The first column tells which file is ignored and the second one informs the rule (pattern) used for the match.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">trunk<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>admin                                  trunk<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>frontend                               trunk<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>project_autoload.cache                 trunk<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>filter<span style="color: #000000; font-weight: bold;">/</span>doctrine<span style="color: #000000; font-weight: bold;">/</span>base<span style="color: #000000; font-weight: bold;">/</span>BaseMyClassFormFilter.class.php trunk<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/**/</span>base<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>form<span style="color: #000000; font-weight: bold;">/</span>doctrine<span style="color: #000000; font-weight: bold;">/</span>base<span style="color: #000000; font-weight: bold;">/</span>BaseMyClassForm.class.php trunk<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/**/</span>base<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>model<span style="color: #000000; font-weight: bold;">/</span>doctrine<span style="color: #000000; font-weight: bold;">/</span>base<span style="color: #000000; font-weight: bold;">/</span>BaseMyClass.class.php trunk<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/**/</span>base<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>admin_dev.log                            trunk<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>frontend_dev.log                         trunk<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.channels                            trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.<span style="color: #000000; font-weight: bold;">*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.depdb                               trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.<span style="color: #000000; font-weight: bold;">*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.depdblock                           trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.<span style="color: #000000; font-weight: bold;">*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.filemap                             trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.<span style="color: #000000; font-weight: bold;">*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.lock                                trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.<span style="color: #000000; font-weight: bold;">*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.registry                            trunk<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>.<span style="color: #000000; font-weight: bold;">*</span>
trunk<span style="color: #000000; font-weight: bold;">/</span>web<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span>                     trunk<span style="color: #000000; font-weight: bold;">/</span>web<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/*</span></pre></div></div>

<p>Comments are very much appreciated!</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/ignored-files-in-bazaar-in-asymfony-project/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PureFTP + MySQL with pure-uploadscript functionallity</title>
		<link>http://blog.melimato.com/pureftp-mysql-with-pure-uploadscript-functionallity/</link>
		<comments>http://blog.melimato.com/pureftp-mysql-with-pure-uploadscript-functionallity/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 14:46:21 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[ftp]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pure-ftpd]]></category>
		<category><![CDATA[pure-uploadscript]]></category>
		<category><![CDATA[pureadmin]]></category>
		<category><![CDATA[pureftpd]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/?p=154</guid>
		<description><![CDATA[First lets install pureftpd using apt-get: Install pureftpd with the MySQL backend: apt-get install pure-ftpd-mysql Since I like having different log files for different services I edit syslog.conf to separate ftp log files to specific one: vi /etc/syslog.conf Add these line at the end of the file: ftp.* /var/log/ftp Create the required file and restart [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fpureftp-mysql-with-pure-uploadscript-functionallity%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fpureftp-mysql-with-pure-uploadscript-functionallity%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>First lets install pureftpd using apt-get:</p>
<p>Install pureftpd with the MySQL backend:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> pure-ftpd-mysql</pre></div></div>

<p><span id="more-154"></span></p>
<p>Since I like having different log files for different services I edit syslog.conf to separate ftp log files to specific one:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>syslog.conf</pre></div></div>

<p>Add these line at the end of the file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ftp.<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>log<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ftp</span></pre></div></div>

<p>Create the required file and restart sysklogd:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ftp</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>sysklogd restart</pre></div></div>

<p>Edit MySQL connection information for pureftpd user:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>db<span style="color: #000000; font-weight: bold;">/</span>mysql.conf</pre></div></div>

<p>Add or uncomment the following lines in the file. Don&#8217;t forget to change the user and password details.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MYSQLSocket      <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>mysqld<span style="color: #000000; font-weight: bold;">/</span>mysqld.sock
MYSQLUser       pure-ftpd
MYSQLPassword   pure-ftpd_pass
MYSQLDatabase   pureftpd
MYSQLCrypt      cleartext
MYSQLGetPW      SELECT Password FROM <span style="color: #c20cb9; font-weight: bold;">users</span> WHERE <span style="color: #007800;">User</span>=<span style="color: #ff0000;">&quot;\L&quot;</span>
MYSQLGetUID     SELECT Uid FROM <span style="color: #c20cb9; font-weight: bold;">users</span> WHERE <span style="color: #007800;">User</span>=<span style="color: #ff0000;">&quot;\L&quot;</span>
MYSQLGetGID     SELECT Gid FROM <span style="color: #c20cb9; font-weight: bold;">users</span> WHERE <span style="color: #007800;">User</span>=<span style="color: #ff0000;">&quot;\L&quot;</span>
MYSQLGetDir     SELECT Dir FROM <span style="color: #c20cb9; font-weight: bold;">users</span> WHERE <span style="color: #007800;">User</span>=<span style="color: #ff0000;">&quot;\L&quot;</span>
MySQLTransactions On</pre></div></div>

<p>Some more configuration settings and pure-uploadscript setup:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> no <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>PAMAuthentication
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>CreateHomeDir
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>CallUploadScript
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>ChrootEveryone</pre></div></div>

<p>Edit PurFtpd&#8217;s common settings:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd-common</pre></div></div>

<p>Change / uncomment the following lines:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">STANDALONE_OR_INETD</span>=standalone
<span style="color: #007800;">VIRTUALCHROOT</span>=<span style="color: #c20cb9; font-weight: bold;">false</span>
<span style="color: #007800;">UPLOADSCRIPT</span>=<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>uploadscript
<span style="color: #007800;">UPLOADUID</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">UPLOADGID</span>=<span style="color: #000000;">0</span></pre></div></div>

<p>Create MySQL users, apply permissions for the details set on /etc/pure-ftpd/db/mysql.conf . Also create users table for PureFtpd web admin:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> pureftpd;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">SELECT</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">INSERT</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">UPDATE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">DELETE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">CREATE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">ON</span> pureftpd<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'pure-ftpd'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'pure-ftpd_pass'</span>;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">SELECT</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">INSERT</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">UPDATE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">DELETE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">CREATE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">ON</span> pureftpd<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'pure-ftpd'</span>@<span style="color: #ff0000;">'localhost.localdomain'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'pure-ftpd_pass'</span>;
<span style="color: #993333; font-weight: bold;">FLUSH</span> PRIVILEGES;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`users`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`User`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Password`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">CHARACTER</span> <span style="color: #993333; font-weight: bold;">SET</span> latin1 <span style="color: #993333; font-weight: bold;">COLLATE</span> latin1_bin <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Uid`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'14'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Gid`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'5'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Dir`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`QuotaFiles`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'500'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`QuotaSize`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'30'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`ULBandwidth`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'80'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`DLBandwidth`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'80'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Ipaddress`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'*'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Comment`</span> tinytext<span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Status`</span> enum<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`ULRatio`</span> <span style="color: #993333; font-weight: bold;">SMALLINT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`DLRatio`</span> <span style="color: #993333; font-weight: bold;">SMALLINT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`User`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">UNIQUE</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`User`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`User`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>InnoDB <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>latin1</pre></div></div>

<p>Create uploadscript.sh referred on previous step:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># UPLOAD_SIZE  : the size of the file, in bytes.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_PERMS : the permissions, as an octal value.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_UID   : the uid of the owner.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_GID   : the group the file belongs to.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_USER  : the name of the owner.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_GROUP : the group name the file belongs to.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_VUSER : the full user name, or the virtual user name. (127 chars max)</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Do something useful</span></pre></div></div>

<p>Install the PureFTPd user manager:</p>
<p>1. Download the user manager for PureFtpd from <a href="http://machiel.generaal.net/index.php?subject=user_manager_pureftpd&#038;button=download">here</a><br />
2. Uncompress the file to a web accessible directory:<br />
3. Point your browser to the chosen directory and open the file install.php<br />
4. Follow the installation steps</p>
<p>And you&#8217;re done!</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/pureftp-mysql-with-pure-uploadscript-functionallity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using apache&#8217;s RedirectMatch instead of ServerAlias to avoid content duplication</title>
		<link>http://blog.melimato.com/using-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication/</link>
		<comments>http://blog.melimato.com/using-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication/#comments</comments>
		<pubDate>Mon, 18 May 2009 00:30:14 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/using-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication/</guid>
		<description><![CDATA[Most web sites I do have many domains but want all those domains to point to the &#8220;main domain&#8221; www.domain.com. My first solution was to put Apaches&#8217;s directive ServerAlias in the site&#8217;s virtual host configuration. This lead to content duplication since domain.com and domain.net and www.domain.com are two different web sites for the rest of [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fusing-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fusing-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Most web sites I do have many domains but want all those domains to point to the &#8220;main domain&#8221; www.domain.com. My first solution was to put Apaches&#8217;s directive <a href="http://httpd.apache.org/docs/2.0/mod/core.html#serveralias">ServerAlias</a> in the site&#8217;s virtual host configuration. This lead to content duplication since domain.com and domain.net and www.domain.com are two different web sites for the rest of the world. To avoid this problem the only solution I&#8217;ve found was to create two different virtual hosts and set Apache&#8217;s <a href="http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect">Redirect</a> directive. The first VirtualHost will hold all the domains aliases and redirect permanently (301) to the &#8220;main domain&#8221;</p>
<p><span id="more-116"></span></p>

<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;">&lt;VirtualHost ip_address:80&gt;
    ServerName domain.com
    ServerAlias domain.net
    ServerAlias domain.biz
    RedirectMatch permanent /(.*) http://www.domain.com/$1
&lt;/VirtualHost&gt;
&nbsp;
&lt;VirtualHost ip_address:80&gt;
    ServerName www.domain.com
    etc...
&lt;/VirtualHost&gt;</pre></div></div>

<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/using-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Get unix timestamp in bash</title>
		<link>http://blog.melimato.com/get-unix-timestamp-in-bash/</link>
		<comments>http://blog.melimato.com/get-unix-timestamp-in-bash/#comments</comments>
		<pubDate>Sat, 09 May 2009 16:04:03 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[date/time]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/?p=108</guid>
		<description><![CDATA[I&#8217;m posting this since I always forget it&#8230; date +%s More info: http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/ Readers who viewed this page, also viewed:Powered by Where did they go from here?]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fget-unix-timestamp-in-bash%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fget-unix-timestamp-in-bash%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;m posting this since I always forget it&#8230;</p>

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

<p>More info: <a href="http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/</a></p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/get-unix-timestamp-in-bash/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Keeping directories in sync with unison</title>
		<link>http://blog.melimato.com/keeping-directories-in-sync-with-unison/</link>
		<comments>http://blog.melimato.com/keeping-directories-in-sync-with-unison/#comments</comments>
		<pubDate>Fri, 08 May 2009 23:24:09 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[unison]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/?p=104</guid>
		<description><![CDATA[As opposed to rsync, unison is a two way file synchronizer. Similar to MySQL&#8217;s master to master replication. To set it up in Ubuntu (Intrepid) keep on reading&#8230; 1. Install unison on both servers apt-get install unison 2. Create a script to add to crontab to call unison periodically unison -numericids -owner -silent -times -contactquietly [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fkeeping-directories-in-sync-with-unison%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fkeeping-directories-in-sync-with-unison%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>As opposed to rsync, unison is a two way file synchronizer. Similar to MySQL&#8217;s master to master replication. To set it up in Ubuntu (Intrepid) keep on reading&#8230;</p>
<p><span id="more-104"></span></p>
<p>1. Install unison on both servers</p>

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

<p>2. Create a script to add to crontab to call unison periodically</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">unison <span style="color: #660033;">-numericids</span> <span style="color: #660033;">-owner</span> <span style="color: #660033;">-silent</span> <span style="color: #660033;">-times</span> <span style="color: #660033;">-contactquietly</span> <span style="color: #660033;">-batch</span> <span style="color: #660033;">-auto</span> <span style="color: #660033;">-log</span> <span style="color: #660033;">-logfile</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>unison.log profile_file <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span></pre></div></div>

<p>3. Create the above mentioned profile file on ~/.unison/profile_file.prf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root = <span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>server_ip<span style="color: #000000; font-weight: bold;">//</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">dir</span>
root = <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">dir</span>
ignore = Regex .<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>cache<span style="color: #000000; font-weight: bold;">|</span>Cache<span style="color: #000000; font-weight: bold;">|</span>te?mp<span style="color: #000000; font-weight: bold;">|</span>logs?<span style="color: #7a0874; font-weight: bold;">&#41;</span>.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #666666; font-style: italic;"># ignore log and cache files</span></pre></div></div>

<p>That&#8217;s it! Now add the following line to your crontab to execute it every 5min</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">5</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>my_unison_script.sh</pre></div></div>

<p>After a few days of running this I found that sometimes one unison execution would overlap another. To resolve this I found a little tool called <a href="http://unixwiz.net/tools/lockrun.html">lockrun</a></p>
<p>To get it to work I did:</p>
<p>1. Download the source code from the official <a href="http://unixwiz.net/tools/lockrun.c">lockrun website</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>unixwiz.net<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>lockrun.c</pre></div></div>

<p>2. Build/install as shown in <a href="http://unixwiz.net/tools/lockrun.html">http://unixwiz.net/tools/lockrun.html</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gcc</span> lockrun.c <span style="color: #660033;">-o</span> lockrun
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> lockrun <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>3. Change the previous crontab line to use lockrun</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">5</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>lockrun <span style="color: #660033;">--lockfile</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>hosting.lockrun <span style="color: #660033;">--</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>my_unison_script.sh</pre></div></div>

<p>All done!!!</p>
<div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/keeping-directories-in-sync-with-unison/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Make svnserve load on startup (Ubuntu)</title>
		<link>http://blog.melimato.com/make-svnserve-load-on-startup-ubuntu/</link>
		<comments>http://blog.melimato.com/make-svnserve-load-on-startup-ubuntu/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 15:23:14 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[svn]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/?p=96</guid>
		<description><![CDATA[Make svnserve load on startup: First create a new script on init.d vi /etc/init.d/svnserve The script&#8217;s contents: #!/bin/bash ### BEGIN INIT INFO # Provides: svnserve # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start subversion server ### END [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fmake-svnserve-load-on-startup-ubuntu%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fmake-svnserve-load-on-startup-ubuntu%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Make svnserve load on startup:</p>
<p>First create a new script on init.d</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svnserve</span></pre></div></div>

<p><span id="more-96"></span></p>
<p>The script&#8217;s contents:</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;">### BEGIN INIT INFO</span>
<span style="color: #666666; font-style: italic;"># Provides:          svnserve</span>
<span style="color: #666666; font-style: italic;"># Required-Start:    $local_fs $remote_fs $network $syslog</span>
<span style="color: #666666; font-style: italic;"># Required-Stop:     $local_fs $remote_fs $network $syslog</span>
<span style="color: #666666; font-style: italic;"># Default-Start:     2 3 4 5</span>
<span style="color: #666666; font-style: italic;"># Default-Stop:      0 1 6</span>
<span style="color: #666666; font-style: italic;"># Short-Description: Start subversion server</span>
<span style="color: #666666; font-style: italic;">### END INIT INFO</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">svnserve</span> <span style="color: #660033;">--listen-host</span>=myhost.com <span style="color: #660033;">-d</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>repos</pre></div></div>

<p>Then make the script is executable</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svnserve</span></pre></div></div>

<p>Use update-rc.d to add script to init</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">update-rc.d <span style="color: #c20cb9; font-weight: bold;">svnserve</span> defaults</pre></div></div>

<p>That&#8217;s it!</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/" rel="bookmark" class="wherego_title">Set new logrotate tasks to rotate apache logs in non-standard directories</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/make-svnserve-load-on-startup-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Set new logrotate tasks to rotate apache logs in non-standard directories</title>
		<link>http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/</link>
		<comments>http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 15:52:36 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[logrotate]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[log]]></category>

		<guid isPermaLink="false">http://www.melimato.com/blog/?p=64</guid>
		<description><![CDATA[I prefer compressing old logs to save space. Edit logrotate.conf vi /etc/logrotate.conf Uncomment the following line: compress Since I keep all my hosting&#8217;s logs in /home/hosting/log I need to add a new task to logrotate: Create a new file under logrotate.d called hosting: vi /etc/logrotate.d/hosting Add the following contents to that file: /home/hosting/*/log/*.log &#123; weekly [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fset-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fset-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I prefer compressing old logs to save space. Edit logrotate.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>logrotate.conf</pre></div></div>

<p><span id="more-64"></span></p>
<p>Uncomment the following line:</p>

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

<p>Since I keep all my hosting&#8217;s logs in /home/hosting/log I need to add a new task to logrotate:</p>
<p>Create a new file under logrotate.d called hosting:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>logrotate.d<span style="color: #000000; font-weight: bold;">/</span>hosting</pre></div></div>

<p>Add the following contents to that file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>hosting<span style="color: #000000; font-weight: bold;">/*/</span>log<span style="color: #000000; font-weight: bold;">/*</span>.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  weekly
    missingok
    rotate <span style="color: #000000;">52</span>
    compress
    delaycompress
    notifempty
    create <span style="color: #000000;">640</span> root adm
    sharedscripts
    postrotate
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 reload <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
        <span style="color: #000000; font-weight: bold;">fi</span>
    endscript
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Explanation of script lines according to man page:</p>
<p><strong>missingok</strong><br />
If the log file is missing, go on to the next one without issuing an error message.</p>
<p><strong>rotate</strong> <em>count</em><br />
Log files are rotated <count> times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather then rotated.<br />
In our case we will remove logfiles older than 1 year (52 weeks)</p>
<p><strong>compress</strong><br />
Duh!</p>
<p><strong>delaycompress</strong><br />
Postpone compression of the previous log file to the next rotation cycle. This has only effect when used in combination with compress. It can be used when some program can not be told to close its logfile and thus might continue writing to the previous log file for some time.</p>
<p><strong>notifempty</strong><br />
Do not rotate the log if it is empty (this overrides the ifempty option).</p>
<p><strong>create</strong> <em>mode owner group</em><br />
Immediately after rotation (before the postrotate script is run) the log file is created (with the same name as the log file just rotated).  mode specifies the mode for the log file in octal (the same as chmod(2)), owner specifies the user name who will own the log file, and group specifies the group the log file will belong to. Any of the log file attributes may be omitted, in which case those attributes for the new file will use the same values as the original log file for the omitted attributes. This option can be disabled using the nocreate option.</p>
<p><strong>sharedscripts</strong><br />
Normally, <strong>prescript</strong> and <strong>postscript</strong> scripts are run for each log which is rotated, meaning that a single script may be run multiple times for log file entries which match multiple files (such as the /var/log/news/* example). If <strong>sharedscript</strong> is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern. However, if none of the logs in the pattern require rotating, the scripts will not be run at all. This option overrides the nosharedscripts option and implies <strong>create</strong> option.<br />
<strong>postrotate/endscript</strong><br />
The lines between postrotate and endscript (both of which must appear on lines by themselves) are executed after the log file is rotated. These directives may only appear inside of a log file definition.</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://blog.melimato.com/svn-setup-and-migration/" rel="bookmark" class="wherego_title">svn setup and migration</a></li><li><a href="http://blog.melimato.com/make-svnserve-load-on-startup-ubuntu/" rel="bookmark" class="wherego_title">Make svnserve load on startup (Ubuntu)</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

