<?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>Perplexed Labs &#187; backup</title>
	<atom:link href="http://blog.perplexedlabs.com/tag/backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.perplexedlabs.com</link>
	<description>web development war stories from the frontlines to the backend</description>
	<lastBuildDate>Mon, 16 May 2011 14:19:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Backing Up Subversion Repositories Using svnadmin hotcopy</title>
		<link>http://blog.perplexedlabs.com/2009/09/11/backing-up-subversion-repositories-using-svnadmin-hotcopy/</link>
		<comments>http://blog.perplexedlabs.com/2009/09/11/backing-up-subversion-repositories-using-svnadmin-hotcopy/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 17:18:02 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[hotcopy]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[svnadmin]]></category>

		<guid isPermaLink="false">http://blog.perplexedlabs.com/?p=363</guid>
		<description><![CDATA[Just wanted to post this quick bash script to iterate over the repositories in a directory, perform an svnadmin hotcopy, and tar/gzip the output. By using hotcopy this can be performed on a live subversion repository and will produce a pristine backup. #!/bin/bash REPOS_PATH=/var/repos mkdir -p /backups/weekly rm -rf /backups/tmp mkdir -p /backups/tmp/repos for i [...]


Related posts:<ol><li><a href='http://blog.perplexedlabs.com/2009/02/09/automated-backups-a-5-minute-script-to-safer-data/' rel='bookmark' title='Permanent Link: Automated Backups &#8211; A 5 Minute Script To Safer Data'>Automated Backups &#8211; A 5 Minute Script To Safer Data</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/03/18/svn-keyword-substitution/' rel='bookmark' title='Permanent Link: SVN Keyword Substitution svn:keywords'>SVN Keyword Substitution svn:keywords</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/11/10/setup-python-25-mod_wsgi-and-django-10-on-centos-5-cpanel/' rel='bookmark' title='Permanent Link: Setup Python 2.5, mod_wsgi, and Django 1.0 on CentOS 5 (cPanel)'>Setup Python 2.5, mod_wsgi, and Django 1.0 on CentOS 5 (cPanel)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Just wanted to post this quick bash script to iterate over the repositories in a directory, perform an svnadmin hotcopy, and tar/gzip the output.</p>
<p>By using hotcopy this can be performed on a live subversion repository and will produce a pristine backup.</p>
<pre class="brush: bash; title: ;">
#!/bin/bash
REPOS_PATH=/var/repos
mkdir -p /backups/weekly
rm -rf /backups/tmp
mkdir -p /backups/tmp/repos
for i in $(ls $REPOS_PATH); do
        /path/to/svnadmin hotcopy $REPOS_PATH/$i /backups/tmp/repos/$i
done
FN=svn.weekly.`date '+%Y%m%d'`.tar.gz
tar -czf /backups/weekly/$FN -C /backups/tmp .
</pre>


<p>Related posts:<ol><li><a href='http://blog.perplexedlabs.com/2009/02/09/automated-backups-a-5-minute-script-to-safer-data/' rel='bookmark' title='Permanent Link: Automated Backups &#8211; A 5 Minute Script To Safer Data'>Automated Backups &#8211; A 5 Minute Script To Safer Data</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/03/18/svn-keyword-substitution/' rel='bookmark' title='Permanent Link: SVN Keyword Substitution svn:keywords'>SVN Keyword Substitution svn:keywords</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/11/10/setup-python-25-mod_wsgi-and-django-10-on-centos-5-cpanel/' rel='bookmark' title='Permanent Link: Setup Python 2.5, mod_wsgi, and Django 1.0 on CentOS 5 (cPanel)'>Setup Python 2.5, mod_wsgi, and Django 1.0 on CentOS 5 (cPanel)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.perplexedlabs.com/2009/09/11/backing-up-subversion-repositories-using-svnadmin-hotcopy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automated Backups &#8211; A 5 Minute Script To Safer Data</title>
		<link>http://blog.perplexedlabs.com/2009/02/09/automated-backups-a-5-minute-script-to-safer-data/</link>
		<comments>http://blog.perplexedlabs.com/2009/02/09/automated-backups-a-5-minute-script-to-safer-data/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 20:16:24 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqldump]]></category>

		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=178</guid>
		<description><![CDATA[Sometimes, taking a few minutes to do a simple thing will save you a headache down the road.  Like changing the oil in your car, or brushing your teeth every night, or automatically backing up your databases. The development server that I mess around on has recently accumulated a lot of data that I really [...]


Related posts:<ol><li><a href='http://blog.perplexedlabs.com/2008/02/05/mysqldump-usage/' rel='bookmark' title='Permanent Link: mysqldump usage'>mysqldump usage</a></li>
<li><a href='http://blog.perplexedlabs.com/2009/09/11/backing-up-subversion-repositories-using-svnadmin-hotcopy/' rel='bookmark' title='Permanent Link: Backing Up Subversion Repositories Using svnadmin hotcopy'>Backing Up Subversion Repositories Using svnadmin hotcopy</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/02/04/building-a-rails-capable-slice-from-scratch/' rel='bookmark' title='Permanent Link: Ruby On Rails and SliceHost Part 1: Initial Setup'>Ruby On Rails and SliceHost Part 1: Initial Setup</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Sometimes, taking a few minutes to do a simple thing will save you a headache down the road.  Like changing the oil in your car, or brushing your teeth every night, or automatically backing up your databases.</p>
<p>The development server that I mess around on has recently accumulated a lot of data that I really don't want to lose, so I whipped up a small script that will help to ensure this never happens.</p>
<blockquote><p>#!/bin/bash<br />
rm -f /path/to/backups/tmp/*<br />
mysqldump --opt --host=localhost --user=USERNAME --password=PASSWORD --all-databases &gt; /path/to/backups/tmp/dbBackup.sql<br />
tar -czvf /path/to/backups/database/mysql.`date '+%Y%m%d%H%M%S'`.tar.gz /backups/tmp<br />
service httpd restart</p></blockquote>
<p>Line by line, what's happening here is:</p>
<ul>
<li>delete the .sql file generated by the previous backup</li>
<li>dump every MySQL table to a file called dbBackup.sql.  You don't have to go this far; check out <a href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html">MySQL's documentation on mysqldump</a> for all the options</li>
<li>tar up the dbBackup.sql file, include a timestamp in the filename</li>
<li>restart Apache</li>
</ul>
<p>I want this script to run every night at 1am, so I added it to the crontab:</p>
<blockquote><p>0 1 * * * /path/to/backup.daily.cron</p></blockquote>
<p>Obviously this is a very simple script that can grow in complexity fairly quickly.  For example, you can clear out old logs (a must for some Rails apps), and do other housekeeping functions.  A good idea would also be to have a syncing program grab that .tar and upload it to your home machine, or even an S3 bucket.</p>
<p>When your MySQL instance gets corrupted or otherwise obliterated, you'll thank yourself for taking 5 minutes to set this up.</p>


<p>Related posts:<ol><li><a href='http://blog.perplexedlabs.com/2008/02/05/mysqldump-usage/' rel='bookmark' title='Permanent Link: mysqldump usage'>mysqldump usage</a></li>
<li><a href='http://blog.perplexedlabs.com/2009/09/11/backing-up-subversion-repositories-using-svnadmin-hotcopy/' rel='bookmark' title='Permanent Link: Backing Up Subversion Repositories Using svnadmin hotcopy'>Backing Up Subversion Repositories Using svnadmin hotcopy</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/02/04/building-a-rails-capable-slice-from-scratch/' rel='bookmark' title='Permanent Link: Ruby On Rails and SliceHost Part 1: Initial Setup'>Ruby On Rails and SliceHost Part 1: Initial Setup</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.perplexedlabs.com/2009/02/09/automated-backups-a-5-minute-script-to-safer-data/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

