<?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>Libre Things &#187; shell script</title>
	<atom:link href="http://positon.org/tag/shell-script/feed" rel="self" type="application/rss+xml" />
	<link>http://positon.org</link>
	<description></description>
	<lastBuildDate>Tue, 23 Feb 2016 20:01:11 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.7.1</generator>
	<item>
		<title>A very simple mysqldump script to backup your databases</title>
		<link>http://positon.org/a-very-simple-mysqldump-script-to-backup-your-databases</link>
		<comments>http://positon.org/a-very-simple-mysqldump-script-to-backup-your-databases#comments</comments>
		<pubDate>Sun, 13 Mar 2011 20:42:00 +0000</pubDate>
		<dc:creator><![CDATA[dooblem]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[shell script]]></category>

		<guid isPermaLink="false">http://positon.org:81/?p=110</guid>
		<description><![CDATA[Here are some lines I&#8217;m using to backup my MySQL databases on my Debian server: #!/bin/sh # This will dump all your databases DATE=$(date +%Y%m%d%H%M) for DB in $(echo &#34;show databases&#34; &#124; mysql --defaults-file=/etc/mysql/debian.cnf -N) do mysqldump --defaults-file=/etc/mysql/debian.cnf $DB &#62; /backup/mysql/${DB}_${DATE}.sql gzip /backup/mysql/${DB}_${DATE}.sql done # purge old dumps find /backup/mysql/ -name &#34;*.sql*&#34; -mtime +8 -exec [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Here are some lines I&#8217;m using to backup my MySQL databases on my Debian server:</p>
<pre>
#!/bin/sh
# This will dump all your databases

DATE=$(date +%Y%m%d%H%M)

for DB in $(echo &quot;show databases&quot; | mysql --defaults-file=/etc/mysql/debian.cnf -N)
do
        mysqldump --defaults-file=/etc/mysql/debian.cnf $DB &gt; /backup/mysql/${DB}_${DATE}.sql

        gzip /backup/mysql/${DB}_${DATE}.sql
done

# purge old dumps
find /backup/mysql/ -name &quot;*.sql*&quot; -mtime +8 -exec rm -vf {} \;
</pre>
<p>You can run it in a cron:</p>
<pre>
11 1 * * * /usr/local/bin/mysqldump.sh &gt; /tmp/mysqldump.log
</pre>
<p>This way any error displayed by the script will be sent by mail to the root user (mail address in <code>/etc/aliases</code>).</p>
<p>If you are not under Debian and there is no password file in /etc/mysql, you should create such file.</p>
]]></content:encoded>
			<wfw:commentRss>http://positon.org/a-very-simple-mysqldump-script-to-backup-your-databases/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
