<?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>Andrew Beaton :: FAQ &#187; Linux</title>
	<atom:link href="http://andrewbeaton.net/faq/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewbeaton.net/faq</link>
	<description>Tips from the world of a software developer</description>
	<lastBuildDate>Wed, 13 Jul 2011 17:03:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Grep to find ^M (Windows carriage return)</title>
		<link>http://andrewbeaton.net/faq/2011/07/13/grep-to-find-m-windows-carriage-return/</link>
		<comments>http://andrewbeaton.net/faq/2011/07/13/grep-to-find-m-windows-carriage-return/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 16:58:17 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[carriage]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[hat m]]></category>
		<category><![CDATA[new line]]></category>
		<category><![CDATA[windows carriage return]]></category>
		<category><![CDATA[\r]]></category>
		<category><![CDATA[^m]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=154</guid>
		<description><![CDATA[There are two options here, one we used before when searching for the ^M&#8217;s in VI, the other is new: ^M $'\r' So to find all files with the Windows carriage return in them, use one of the following&#8230; grep -r &#34;^M&#34; * grep -r $'\r' * ^M is entered by pressing Ctrl+V followed by [...]]]></description>
			<content:encoded><![CDATA[<p>There are two options here, one we used before when searching for the ^M&#8217;s in VI, the other is new:</p>

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


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$<span style="color: #ff0000;">'\r'</span></pre></div></div>

<p>So to find all files with the Windows carriage return in them, use one of the following&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;^M&quot;</span> <span style="color: #000000; font-weight: bold;">*</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-r</span> $<span style="color: #ff0000;">'\r'</span> <span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>^M is entered by pressing <strong>Ctrl+V</strong><strong> followed by <strong>Ctrl+M</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2011/07/13/grep-to-find-m-windows-carriage-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List and Install Security Updates via YUM</title>
		<link>http://andrewbeaton.net/faq/2011/07/08/list-and-install-security-updates-via-yum/</link>
		<comments>http://andrewbeaton.net/faq/2011/07/08/list-and-install-security-updates-via-yum/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 17:04:30 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[YUM]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[updates]]></category>
		<category><![CDATA[yum]]></category>
		<category><![CDATA[yum security]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=151</guid>
		<description><![CDATA[You can now easily find out what security updates there are for your system (RHEL / CentOs / Fedora) by installing the &#8216;yum-security&#8216; plugin. # yum install yum-security To list available updates and see the relevant advisory code, use the following command: # yum list security To obtain information on the returned advisory codes, use [...]]]></description>
			<content:encoded><![CDATA[<p>You can now easily find out what security updates there are for your system (<strong>RHEL</strong> / <strong>CentOs</strong> / <strong>Fedora</strong>) by installing the &#8216;<strong>yum-security</strong>&#8216; plugin.</p>

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

<p>To list available updates and see the relevant advisory code, use the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum list security</span></pre></div></div>

<p>To obtain information on the returned advisory codes, use the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum info-security &lt;ADVISORY CODE&gt;</span></pre></div></div>

<p>To list updates that are security relevent, use the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum --security check-update</span></pre></div></div>

<p>And finally, to install only the security update packages, use the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum update --security</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2011/07/08/list-and-install-security-updates-via-yum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add a program to start on LXDE startup</title>
		<link>http://andrewbeaton.net/faq/2011/07/08/add-a-program-to-start-on-lxde-startup/</link>
		<comments>http://andrewbeaton.net/faq/2011/07/08/add-a-program-to-start-on-lxde-startup/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 16:33:22 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[LXDE]]></category>
		<category><![CDATA[autostart]]></category>
		<category><![CDATA[linux startup]]></category>
		<category><![CDATA[LXDE autostart]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=147</guid>
		<description><![CDATA[If you need to get a program to start every time you boot into LXDE, you simply need to add it to the startup file here: /etc/xdg/lxsession/LXDE/autostart Add a line at the bottom of the file with the @ symbol and the program to run, for example: @conky -c ~/.conky/.conkyrc.main &#38;]]></description>
			<content:encoded><![CDATA[<p>If you need to get a program to start every time you boot into LXDE, you simply need to add it to the startup file here:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xdg<span style="color: #000000; font-weight: bold;">/</span>lxsession<span style="color: #000000; font-weight: bold;">/</span>LXDE<span style="color: #000000; font-weight: bold;">/</span>autostart</pre></div></div>

<p>Add a line at the bottom of the file with the @ symbol and the program to run, for example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">@</span>conky <span style="color: #660033;">-c</span> ~<span style="color: #000000; font-weight: bold;">/</span>.conky<span style="color: #000000; font-weight: bold;">/</span>.conkyrc.main <span style="color: #000000; font-weight: bold;">&amp;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2011/07/08/add-a-program-to-start-on-lxde-startup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>View output of  the dd command</title>
		<link>http://andrewbeaton.net/faq/2011/06/23/view-output-of-dd/</link>
		<comments>http://andrewbeaton.net/faq/2011/06/23/view-output-of-dd/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 10:48:36 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[dd output]]></category>
		<category><![CDATA[dd verbose]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[wipe]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=142</guid>
		<description><![CDATA[Recently whilst wiping some old hard disks I thought it would be useful to see what the &#8216;dd&#8217; command was doing, rather than sitting there blankly for hour. I knocked up a little bash script to run in another terminal that will update the terminal running dd with some useful status information. In this example, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently whilst wiping some old hard disks I thought it would be useful to see what the &#8216;dd&#8217; command was doing, rather than sitting there blankly for hour. I knocked up a little bash script to run in another terminal that will update the terminal running dd with some useful status information.</p>
<p>In this example, dd will be run as&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>random <span style="color: #007800;">of</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda</pre></div></div>

<p>copy the following into ddUpdate.sh for example and run it&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">ddpid</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> auwx <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'/dd if/ &amp;&amp; !/awk/ { print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ddpid</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-USR1</span> <span style="color: #007800;">$ddpid</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
<span style="color: #007800;">ddpid</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> auwx <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'/dd if/ &amp;&amp; !/awk/ { print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>This outputs the following to the terminal running dd&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">xxxxxx records <span style="color: #000000; font-weight: bold;">in</span>
xxxxxx records out
xxxxxx bytes <span style="color: #7a0874; font-weight: bold;">&#40;</span>xx nn<span style="color: #7a0874; font-weight: bold;">&#41;</span> copied, xxxx s, xx MB<span style="color: #000000; font-weight: bold;">/</span>s</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2011/06/23/view-output-of-dd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get DateTime in YYYY-mm-dd HH:MM:SS format using Perl</title>
		<link>http://andrewbeaton.net/faq/2011/04/14/get-datetime-in-yyyy-mm-dd-hhmmss-format-using-perl/</link>
		<comments>http://andrewbeaton.net/faq/2011/04/14/get-datetime-in-yyyy-mm-dd-hhmmss-format-using-perl/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 11:54:34 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[localtime]]></category>
		<category><![CDATA[POSIX]]></category>
		<category><![CDATA[strftime]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[YYYY-mm-dd HH-MM-SS]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=133</guid>
		<description><![CDATA[For many years I&#8217;ve been using the long process of obtaining everything from localtime(), adding 1900 to the year etc. etc. but I&#8217;ve just come across the method below, which uses strftime from the POSIX module. use POSIX; &#160; my $DateTime = strftime &#34;%F %T&#34;, localtime $^T; This gives you: 2006-10-02 02:06:07 Now that&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>For many years I&#8217;ve been using the long process of obtaining everything from <em>localtime()</em>, adding  1900 to the year etc. etc. but I&#8217;ve just come across the method below, which uses <em>strftime</em> from the <a title="POSIX" href="http://perldoc.perl.org/POSIX.html">POSIX</a> module.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">use</span> POSIX<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$DateTime</span> <span style="color: #339933;">=</span> strftime <span style="color: #ff0000;">&quot;%F %T&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066;">localtime</span> <span style="color: #0000ff;">$^T</span><span style="color: #339933;">;</span></pre></div></div>

<p>This gives you:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">2006</span>-<span style="color: #000000;">10</span>-02 02:06:07</pre></div></div>

<p>Now that&#8217;s a lot easier!</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2011/04/14/get-datetime-in-yyyy-mm-dd-hhmmss-format-using-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove ^M character with VI</title>
		<link>http://andrewbeaton.net/faq/2010/11/10/remove-m-character-with-vi/</link>
		<comments>http://andrewbeaton.net/faq/2010/11/10/remove-m-character-with-vi/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 21:54:36 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[VI]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[^m]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=122</guid>
		<description><![CDATA[To remove ^M&#8217;s from a file, type the following: :%s/&#91;ctrlkey+v and ctrl-key+M&#93;//g The actual command is: :%s/^V^M//g]]></description>
			<content:encoded><![CDATA[<p>To remove ^M&#8217;s from a file, type the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>ctrlkey+v and ctrl-key+M<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">//</span>g</pre></div></div>

<p>The actual command is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>^V^M<span style="color: #000000; font-weight: bold;">//</span>g</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2010/11/10/remove-m-character-with-vi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL error /usr/libexec/mysqld: unknown option &#8216;skip-bdb&#8217;</title>
		<link>http://andrewbeaton.net/faq/2010/10/01/mysql-error-usrlibexecmysqld-unkown-option-skip-bdb/</link>
		<comments>http://andrewbeaton.net/faq/2010/10/01/mysql-error-usrlibexecmysqld-unkown-option-skip-bdb/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 11:29:00 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[my.cf]]></category>
		<category><![CDATA[skip-bdb]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/2010/10/01/mysql-error-usrlibexecmysqld-unkown-option-skip-bdb/</guid>
		<description><![CDATA[MySQL version x is failing to start after upgrade with the following error: /usr/libexec/mysqld: unknown option ‘—skip-bdb’ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL version x is failing to start after upgrade with the following error:</p>
<pre class="csharpcode">/usr/libexec/mysqld: unknown option ‘—skip-bdb’</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>To fix comment out the following line in your my.cnf file:</p>
<pre class="csharpcode">#skip-bdb</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</p>
<p>You should now be able to restart MySQL</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2010/10/01/mysql-error-usrlibexecmysqld-unkown-option-skip-bdb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix Mail Queue Commands</title>
		<link>http://andrewbeaton.net/faq/2010/03/10/postfix-mail-queue-commands/</link>
		<comments>http://andrewbeaton.net/faq/2010/03/10/postfix-mail-queue-commands/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 21:03:58 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[flush]]></category>
		<category><![CDATA[mail queue]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=105</guid>
		<description><![CDATA[To resend the mails in the mail queue, type either of the following two commands]]></description>
			<content:encoded><![CDATA[<p>To resend the mails in the mail queue, type either of the following two commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># postfix flush</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># postfix -f</span></pre></div></div>

<p>To see the mail queue, type:</p>

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

<p>To remove all mail from the mail queue, type:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># postsuper -d ALL</span></pre></div></div>

<p>To remove all mails in the deferred mail queue, type:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># postsuper -d ALL deferred</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2010/03/10/postfix-mail-queue-commands/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Run a cron job every x seconds</title>
		<link>http://andrewbeaton.net/faq/2010/01/26/run-a-cron-job-every-x-seconds/</link>
		<comments>http://andrewbeaton.net/faq/2010/01/26/run-a-cron-job-every-x-seconds/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:38:57 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[cron job]]></category>
		<category><![CDATA[schedule]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=96</guid>
		<description><![CDATA[As most of you know, the smallest time a cron job can be configured to run is every minute. To run a script every 15 seconds for example, you could use the following: main cron job: * * * * * /path/to/wrapper.sh wrapper.sh: /path/to/script &#38; sleep 15 /path/to/script &#38; sleep 15 /path/to/script &#38; sleep 15 [...]]]></description>
			<content:encoded><![CDATA[<p>As most of you know, the smallest time a cron job can be configured to run is every minute.<br />
To run a script every 15 seconds for example, you could use the following:</p>
<p><strong>main cron job:</strong></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; 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>wrapper.sh</pre></div></div>

<p><strong>wrapper.sh:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><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>script <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">15</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>script <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">15</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>script <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">15</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>script <span style="color: #000000; font-weight: bold;">&amp;</span></pre></div></div>

<p>If you can suggest any nicer alternatives to this example, please let me know. <img src='http://andrewbeaton.net/faq/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2010/01/26/run-a-cron-job-every-x-seconds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can&#8217;t create table &#8211; errno: 13</title>
		<link>http://andrewbeaton.net/faq/2009/12/30/cant-create-table-errno-13/</link>
		<comments>http://andrewbeaton.net/faq/2009/12/30/cant-create-table-errno-13/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 16:19:22 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[create temporary table]]></category>
		<category><![CDATA[errno: 13]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=89</guid>
		<description><![CDATA[I came across a problem today when trying to create a temporary table in MySQL. ERROR 1005 &#40;HY000&#41;: Can't create table 'temptable' (errno: 13) The first thing I checked was that the user in question had the Create_tmp_table_priv privilege in the users table, which it did. The next step was to find out where MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>I came across a problem today when trying to create a temporary table in MySQL.</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">ERROR <span style="color: #008080;">1005</span> <span style="color: #FF00FF;">&#40;</span>HY000<span style="color: #FF00FF;">&#41;</span>: Can<span style="color: #008000;">'t create table '</span><span style="color: #990099; font-weight: bold;">temptable</span><span style="color: #008000;">' (errno: 13)</span></pre></div></div>

<p>The first thing I checked was that the user in question had the <strong>Create_tmp_table_priv</strong> privilege in the users table, which it did.</p>
<p>The next step was to find out where MySQL was writing the temporary tables. </p>
<p>The following command tells us this:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">show</span> variables <span style="color: #CC0099; font-weight: bold;">like</span> <span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>dir'</span><span style="color: #000033;">;</span>
<span style="color: #CC0099;">+---------------------------+----------------------------+</span>
<span style="color: #CC0099;">|</span> Variable_name             <span style="color: #CC0099;">|</span> <span style="color: #990099; font-weight: bold;">Value</span>                      <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+---------------------------+----------------------------+</span>
<span style="color: #CC0099;">|</span> basedir                   <span style="color: #CC0099;">|</span> <span style="color: #CC0099;">/</span>usr<span style="color: #CC0099;">/</span>                      <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> bdb_logdir                <span style="color: #CC0099;">|</span>                            <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> bdb_tmpdir                <span style="color: #CC0099;">|</span> <span style="color: #CC0099;">/</span>tmp<span style="color: #CC0099;">/</span>                      <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> character_sets_dir        <span style="color: #CC0099;">|</span> <span style="color: #CC0099;">/</span>usr<span style="color: #CC0099;">/</span>share<span style="color: #CC0099;">/</span>mysql<span style="color: #CC0099;">/</span>charsets<span style="color: #CC0099;">/</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> datadir                   <span style="color: #CC0099;">|</span> <span style="color: #CC0099;">/</span>var<span style="color: #CC0099;">/</span>lib<span style="color: #CC0099;">/</span>mysql<span style="color: #CC0099;">/</span>            <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> innodb_data_home_dir      <span style="color: #CC0099;">|</span>                            <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> innodb_log_arch_dir       <span style="color: #CC0099;">|</span>                            <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> innodb_log_group_home_dir <span style="color: #CC0099;">|</span> .<span style="color: #CC0099;">/</span>                         <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> slave_load_tmpdir         <span style="color: #CC0099;">|</span> <span style="color: #CC0099;">/</span>tmp<span style="color: #CC0099;">/</span>                      <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> tmpdir                    <span style="color: #CC0099;">|</span> <span style="color: #CC0099;">/</span>tmp<span style="color: #CC0099;">/</span>                      <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+---------------------------+----------------------------+</span></pre></div></div>

<p>And from that we see the tmpdir is located in /tmp/.</p>
<p>A quick checked revealed that MySQL could not create files in this directory, no write access, so a simple permissions change and all was well again.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2009/12/30/cant-create-table-errno-13/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

