<?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>/kb &#187; backup</title>
	<atom:link href="http://grx.no/kb/tag/backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://grx.no/kb</link>
	<description>personal knowledgebase</description>
	<lastBuildDate>Wed, 15 Jun 2011 07:07:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Importing a MySQL dump file</title>
		<link>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/</link>
		<comments>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 17:58:32 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=88</guid>
		<description><![CDATA[mysql -h SERVER -uUSER -p DATABASE &#60; DUMPFILE]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-h</span> SERVER <span style="color: #660033;">-uUSER</span> <span style="color: #660033;">-p</span> DATABASE <span style="color: #000000; font-weight: bold;">&lt;</span> DUMPFILE</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Backing up my Macbook with rsync, SSH and Cron</title>
		<link>http://grx.no/kb/2008/09/13/backing-up-my-macbook-with-rsync-ssh-and-cron/</link>
		<comments>http://grx.no/kb/2008/09/13/backing-up-my-macbook-with-rsync-ssh-and-cron/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 21:29:12 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=70</guid>
		<description><![CDATA[I&#8217;ve created a simple script which syncs my documents folder with a remote computer. The files are transferred across the SSH protocol and the backup is performed daily with assistance of cron. My rsync script is very simple: #!/bin/bash rsync -avzr --delete-excluded --exclude=&#34;*.log&#34; --exclude=&#34;*.aux&#34; --exclude=&#34;.svn&#34; --exclude=&#34;.classpath&#34; --exclude=&#34;.cache&#34; --exclude=&#34;.project&#34; --exclude=&#34;*.class&#34; --exclude=&#34;*.swp&#34; --exclude=&#34;.DS_Store&#34; --exclude=&#34;.metadata&#34; -e &#34;ssh -c [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a simple script which syncs my documents folder with a remote computer. The files are transferred across the SSH protocol and the backup is performed daily with assistance of cron.</p>
<p>My rsync script is very simple:</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>
rsync <span style="color: #660033;">-avzr</span> <span style="color: #660033;">--delete-excluded</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;*.log&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;*.aux&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.svn&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.classpath&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.cache&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.project&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;*.class&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;*.swp&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.DS_Store&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.metadata&quot;</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;ssh -c blowfish&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>Documents USER<span style="color: #000000; font-weight: bold;">@</span>REMOTE_COMPUTER:REMOTE_DIRECTORY</pre></div></div>

<p>It was quite tricky to set up the cron job until i realized that cron does know very little of the user&#8217;s system. The trick was to add <code>SSH_AUTH_SOCK=/tmp/501/SSHKeychain.socket</code> in front of the script refrence in crontab, so that it looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">55</span> <span style="color: #000000;">21</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: #007800;">SSH_AUTH_SOCK</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">501</span><span style="color: #000000; font-weight: bold;">/</span>SSHKeychain.socket <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>backup.sh</pre></div></div>

<p>This will cause the backup script to run at 21:55 each night. For more info on cron, check out <a href="http://www.unixgeeks.org/security/newbie/unix/cron-1.html">unixgeeks.org</a>. Add the following at the end if you&#8217;d like to suppress the mail from cron: <code> >&#038; /dev/null</code>.</p>
<p>Note that for this script to run, SSH has to be set up with <a href="http://www.petefreitag.com/item/532.cfm">keypairs authentication.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/09/13/backing-up-my-macbook-with-rsync-ssh-and-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup a MySQL database with mysqldump</title>
		<link>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/</link>
		<comments>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/#comments</comments>
		<pubDate>Wed, 14 May 2008 16:29:50 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqladmin]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=13</guid>
		<description><![CDATA[It&#8217;s very easy, but I always have to look it up. mysqldump --opt -u USERNAME -p -h HOST.HOST.COM DATABASE_TABLE &#62; DUMPFILE.sql]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very easy, but I always have to look it up.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">--opt</span> <span style="color: #660033;">-u</span> USERNAME <span style="color: #660033;">-p</span> <span style="color: #660033;">-h</span> HOST.HOST.COM DATABASE_TABLE <span style="color: #000000; font-weight: bold;">&gt;</span> DUMPFILE.sql</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

