<?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>Zenovation's Blog &#187; Linux</title>
	<atom:link href="http://zenovations.com/blog/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://zenovations.com/blog</link>
	<description>A blog about web design, programming, hosting, and virtualmin hacks</description>
	<lastBuildDate>Mon, 16 Jan 2012 15:01:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Advanced Bash Scripting Guide</title>
		<link>http://zenovations.com/blog/2011/07/advanced-bash-scripting-guide/</link>
		<comments>http://zenovations.com/blog/2011/07/advanced-bash-scripting-guide/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 06:36:14 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/?p=253</guid>
		<description><![CDATA[This guide really is a complete resource for understanding bash syntax; very easy to get around and understand. http://tldp.org/LDP/abs/html/index.html]]></description>
			<content:encoded><![CDATA[<p>This guide really is a complete resource for understanding bash syntax; very easy to get around and understand.</p>
<p><a href="http://tldp.org/LDP/abs/html/index.html">http://tldp.org/LDP/abs/html/index.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2011/07/advanced-bash-scripting-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending Mail From Bash Scripts with an Attachment</title>
		<link>http://zenovations.com/blog/2010/04/sending-mail-from-bash-scripts-with-an-attachment/</link>
		<comments>http://zenovations.com/blog/2010/04/sending-mail-from-bash-scripts-with-an-attachment/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 14:06:02 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/?p=186</guid>
		<description><![CDATA[Here is a great little tut on getting started in Bash. I&#8217;d recommend it to anyone trying to hack their way into a shell script. Here is a quick script for sending an email: ?View Code BASH#!/bin/bash &#160; # Subject of email SUBJECT=&#34;Test email with attachment from a bash script&#34; &#160; # Where to send [...]]]></description>
			<content:encoded><![CDATA[<p>Here is <a href="http://www.linux.org/lessons/advanced/x1110.html">a great little tut on getting started in Bash</a>. I&#8217;d recommend it to anyone trying to hack their way into a shell script.</p>
<p>Here is a quick script for sending an email:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p186code2'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1862"><td class="code" id="p186code2"><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;"># Subject of email</span>
<span style="color: #007800;">SUBJECT</span>=<span style="color: #ff0000;">&quot;Test email with attachment from a bash script&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Where to send it</span>
<span style="color: #007800;">TO_ADDRESS</span>=<span style="color: #ff0000;">&quot;your@email.com&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Where the attachment is</span>
<span style="color: #007800;">ATTACHMENT_FILE</span>=<span style="color: #ff0000;">&quot;/tmp/attachment.txt&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># For fun, let's put something into the attachment</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;This goes into the file.&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;</span>  <span style="color: #007800;">$ATTACHMENT_FILE</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;This appends to the file.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$ATTACHMENT_FILE</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># send the message</span>
<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mail <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SUBJECT</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TO_ADDRESS</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$ATTACHMENT_FILE</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2010/04/sending-mail-from-bash-scripts-with-an-attachment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dropping multiple tables in mysql (drop tables with wildcard)</title>
		<link>http://zenovations.com/blog/2008/08/dropping-multiple-tables-in-mysql-drop-tables-with-wildcard/</link>
		<comments>http://zenovations.com/blog/2008/08/dropping-multiple-tables-in-mysql-drop-tables-with-wildcard/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 17:02:03 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Web Server]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/2008/08/dropping-multiple-tables-in-mysql-drop-tables-with-wildcard/</guid>
		<description><![CDATA[I wanted to drop all mysql tables from a db that had a certain prefix, such as xx_. Well this turned out to be an adventure&#8230; The First Attempt The first solution I found was to use sed/grep sort of logic: ?View Code BASH#mysqlshow -u username -p dbname xx\\_% &#124;sed 's/[&#124;+-]//g'&#124;sed 's/[ ]*$/,/'&#62;droptables.sql (xx\\_% is [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to drop all mysql tables from a db that had a certain prefix, such as xx_. </p>
<p>Well this turned out to be an adventure&#8230;</p>
<p><strong>The First Attempt</strong></p>
<p>The first solution I found was to use sed/grep sort of logic:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p109code6'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1096"><td class="code" id="p109code6"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#mysqlshow -u username -p dbname xx\\_% |sed 's/[|+-]//g'|sed 's/[ ]*$/,/'&gt;droptables.sql</span></pre></td></tr></table></div>

<p>(xx\\_% is how you tell it to show tables starting with xx_)</p>
<p>This produced a semi-useful list. But I had to manually edit out the extra commas and line feeds to get a pure list, then add &#8220;DROP TABLE &#8221; to the beginning of the list. Then feed this into mysql as follows:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p109code7'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1097"><td class="code" id="p109code7"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#mysql -u username -p dbname &lt; droptables.sql</span></pre></td></tr></table></div>

<p>I wasn&#8217;t real happy with that answer, naturally, so I researched more&#8230;</p>
<p><strong>A Better Solution</strong></p>
<p>I came across an alternative in this command:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p109code8'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1098"><td class="code" id="p109code8"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">-u</span> username <span style="color: #660033;">-p</span> <span style="color: #660033;">--add-drop-table</span> <span style="color: #660033;">--no-data</span> dbname <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^DROP.*\`xx_&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mysql <span style="color: #660033;">-u</span> username <span style="color: #660033;">-p</span> dbname</pre></td></tr></table></div>

<p>(replace xx_ with the prefix you want to remove, to do all tables, try just &#8220;grep ^DROP&#8221;</p>
<p>You can test it first by cutting off the last &#8220;| mysql&#8230;&#8221; bit and see the output, which is useful for debugging, before you go blowing away your tables.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2008/08/dropping-multiple-tables-in-mysql-drop-tables-with-wildcard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Starting services automatically in CentOS</title>
		<link>http://zenovations.com/blog/2008/08/starting-services-automatically-in-centos/</link>
		<comments>http://zenovations.com/blog/2008/08/starting-services-automatically-in-centos/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 03:24:03 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Web Server]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/2008/08/starting-services-automatically-in-centos/</guid>
		<description><![CDATA[Had a service in CentOS 4 server that went down every time the box rebooted. Got tired of starting it manually so I had to go find the command to start it automagically. Surprisingly, it has nothing to do with &#8220;service&#8221;, which is how you start/stop it manually. It has the very unintuitive command &#8220;chkconfig&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Had a service in CentOS 4 server that went down every time the box rebooted. Got tired of starting it manually so I had to go find the command to start it automagically.</p>
<p>Surprisingly, it has nothing to do with &#8220;service&#8221;, which is how you start/stop it manually. It has the very unintuitive command &#8220;chkconfig&#8221; to make it start on boot. What a choice: chckconfig!</p>
<p>Oh well, here it is:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p108code10'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10810"><td class="code" id="p108code10"><pre class="bash" style="font-family:monospace;">chkconfig <span style="color: #660033;">--add</span> httpd
chkconfig httpd on</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2008/08/starting-services-automatically-in-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding group/world writable files and directories in Linux</title>
		<link>http://zenovations.com/blog/2007/11/finding-groupworld-writable-files-and-directories-in-linux/</link>
		<comments>http://zenovations.com/blog/2007/11/finding-groupworld-writable-files-and-directories-in-linux/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 17:30:51 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[code clips]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/2007/11/finding-groupworld-writable-files-and-directories-in-linux/</guid>
		<description><![CDATA[?View Code BASHfind / -type f \&#40; -perm -2 -o -perm -20 \&#41; -exec ls -lg &#123;&#125; \;]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p105code12'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10512"><td class="code" id="p105code12"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-type</span> f \<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #660033;">-perm</span> <span style="color: #660033;">-2</span> <span style="color: #660033;">-o</span> <span style="color: #660033;">-perm</span> <span style="color: #660033;">-20</span> \<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lg</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2007/11/finding-groupworld-writable-files-and-directories-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Burning CD&#8217;s in Ubuntu 7.1 Feisty</title>
		<link>http://zenovations.com/blog/2007/11/burning-cds-in-ubuntu-71-feisty/</link>
		<comments>http://zenovations.com/blog/2007/11/burning-cds-in-ubuntu-71-feisty/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 16:08:42 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/2007/11/burning-cds-in-ubuntu-71-feisty/</guid>
		<description><![CDATA[Tried to burn an ISO image in Feisty&#8230; although the CD-ROM drive is detected and it recognizes when I put a CD in, it won&#8217;t run. It shows a message like the following: Please insert a rewritable or blank CD. I hit the forums and found this very relevant discussion.[/url] Apparently the forums hit the [...]]]></description>
			<content:encoded><![CDATA[<p>Tried to burn an ISO image in Feisty&#8230; although the CD-ROM drive is detected and it recognizes when I put a CD in, it won&#8217;t run. It shows a message like the following:</p>
<blockquote><p>Please insert a rewritable or blank CD.</p></blockquote>
<p>I hit the forums and found <a href="http://ubuntuforums.org/showthread.php?t=235">this very relevant discussion.[/url] Apparently the <i>forums</i> hit the forums&#8230; because their solution pointed to [url=http://www.xcdroast.org]www.xcdroast.org</a>, who had this to say:</p>
<blockquote><p>Linux Kernel 2.6.8 broke CD-Writing:<br />
I had several reports that the last 2.6.x kernel broke CD-Writing using the ATAPI driver. Don&#8217;t update if you want to continue to use X-CD-Roast, or switch back to SCSI-emulation.<br />
Update: When started from a root shell burning still works, but non-root mode is disabled by this kernel.</p></blockquote>
<p>So the solution is to run the programs as root. I was able to burn my cd using:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p103code14'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10314"><td class="code" id="p103code14"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>Tiki:~<span style="color: #666666; font-style: italic;"># cdrecord dev=/dev/cdrw1 driveropts=burnfree -v -data /home/kato/Desktop/tmp/ubuntu-6.06.1-server-i386.iso</span></pre></td></tr></table></div>

<p>Looks like others used <span style="color: #ffffff;">sudo k3d</span> with comparable success.</p>
<p>I didn&#8217;t bother trying to figure out which program the &#8220;Write to Disk&#8221; command traces back to. But it looks like K3d already has a fix. Maybe Ubuntu will provide a fix soon, too&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2007/11/burning-cds-in-ubuntu-71-feisty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CVS tunnel via CLI SSH</title>
		<link>http://zenovations.com/blog/2007/05/cvs-tunnel-via-cli-ssh/</link>
		<comments>http://zenovations.com/blog/2007/05/cvs-tunnel-via-cli-ssh/#comments</comments>
		<pubDate>Sat, 05 May 2007 08:55:25 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[code clips]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/2007/05/cvs-tunnel-via-cli-ssh/</guid>
		<description><![CDATA[?View Code BASH/usr/bin/ssh -v -a -L 2401:localhost:2401 cvsnobody@ns2.cyterm.com]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p99code16'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9916"><td class="code" id="p99code16"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-v</span> <span style="color: #660033;">-a</span> <span style="color: #660033;">-L</span> <span style="color: #000000;">2401</span>:localhost:<span style="color: #000000;">2401</span>  cvsnobody<span style="color: #000000; font-weight: bold;">@</span>ns2.cyterm.com</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2007/05/cvs-tunnel-via-cli-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

