<?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>GeekyBoy.com</title>
	<atom:link href="http://www.geekyboy.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.geekyboy.com</link>
	<description>Information Technology I may want to remember someday.</description>
	<lastBuildDate>Sat, 24 Apr 2010 01:58:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Install APC (alternative PHP cache) on RedHat RHEL 5</title>
		<link>http://www.geekyboy.com/?p=299</link>
		<comments>http://www.geekyboy.com/?p=299#comments</comments>
		<pubDate>Wed, 27 May 2009 20:33:20 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[OS]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[optcode cache]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[phpize]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[rhel]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=299</guid>
		<description><![CDATA[In this post I show how I installed APC, a Pecl extension to PHP, on a Red Hat 5 server.]]></description>
			<content:encoded><![CDATA[<p>After attending php|tek 2009 I decided it was finally time for me to play with APC, and at least install it on a server to see what all of the excitement is about.  After all, if it is good enough for Facebook it must be pretty beneficial, right?</p>
<p>According to the documentation the following command is what it takes to install:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pecl <span style="color: #c20cb9; font-weight: bold;">install</span> apc</pre></div></div>

<p>However, then I tried this I quickly received an error stating &#8220;phpize: command not found&#8221;.  So after a little searching I discovered that I needed to install php-devel.i386 to enable pear to install packages. (You may also need to install autoconf, automake and libtool to do phpize.  I must have already had them installed.)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> yum <span style="color: #c20cb9; font-weight: bold;">install</span> php-devel.i386</pre></div></div>

<p>Note: I used sudo, but you can also use su to change to the root user and then run the command as root.</p>
<p>Now after installing that, which also installed a couple of dependencies and updated a couple of other applications, I figured I would be all set.  To the contrary I tried the install apc command again and I received one prompt asking:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Use apxs to <span style="color: #000000; font-weight: bold;">set</span> compile flags <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">if</span> using APC with Apache<span style="color: #7a0874; font-weight: bold;">&#41;</span>? <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>:</pre></div></div>

<p>I received a new error after answering &#8220;yes&#8221; :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Sorry, I was not able to successfully run APXS.  Possible reasons:
&nbsp;
1.  Perl is not installed;
2.  Apache was not compiled with DSO support <span style="color: #7a0874; font-weight: bold;">&#40;</span>--enable-module=so<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
3.  <span style="color: #ff0000;">'apxs'</span> is not <span style="color: #000000; font-weight: bold;">in</span> your path.  Try to use <span style="color: #660033;">--with-apxs</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>apxs
The output of apxs follows
<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>tmpArfGXr<span style="color: #000000; font-weight: bold;">/</span>APC-3.0.10<span style="color: #000000; font-weight: bold;">/</span>configure: line <span style="color: #000000;">3196</span>: apxs: <span style="color: #7a0874; font-weight: bold;">command</span> not found
configure: error: Aborting
ERROR: <span style="color: #000000; font-weight: bold;">`/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>tmpArfGXr<span style="color: #000000; font-weight: bold;">/</span>APC-3.0.10<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-apc-mmap</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #660033;">--with-apxs</span><span style="color: #ff0000;">' failed</span></pre></div></div>

<p>After a few minutes of searching I found a post somewhere that informed me that httpd-devel.i386 also needed to be installed.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> yum <span style="color: #c20cb9; font-weight: bold;">install</span> httpd-devel.i386</pre></div></div>

<p>Once the package installed, along with a few more dependencies and updates, I was then ready to try again.  This time all went well, and APC was installed.</p>
<p>One final step was to activate it in the php.ini file.  I added the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">extension</span>=apc.so
apc.enabled = On</pre></div></div>

<p>Next I was ready to restart Apache and see APC in action:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>httpd restart</pre></div></div>

<p>After creating a quick phpinfo() call I could now see that the APC module was indeed active.  Once I copied the apc.php file that comes with the APC install files into a web accessible directory (preferably password protected) I was clearly able to see stats associated with APC.</p>
<p>There is much more you can do with APC settings, etc.  However, that is another story for another time.  Here are a couple of links to help get you started though.<br />
<a href="http://c7y.phparch.com/c/entry/1/art,apc_facebook">C7y Tutorial</a><br />
<a href="http://pecl.php.net/package/APC">Pecl page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=299</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing mhash on RHEL 4 and PHP 4.3.9</title>
		<link>http://www.geekyboy.com/?p=283</link>
		<comments>http://www.geekyboy.com/?p=283#comments</comments>
		<pubDate>Sun, 17 May 2009 15:04:08 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[libmhash]]></category>
		<category><![CDATA[mhash]]></category>
		<category><![CDATA[php4]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[rhel]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=283</guid>
		<description><![CDATA[Recently I had a customer that was receiving errors from an Authorize.Net web submit form in their shopping cart.  The error simply stated:
&#8220;The gateway no longer supports the requested method of integration.&#8221;
While doing some digging I found that they were using a very old web submit method that Authorize.Net no longer supported.  There [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had a customer that was receiving errors from an Authorize.Net web submit form in their shopping cart.  The error simply stated:</p>
<p><strong><em>&#8220;The gateway no longer supports the requested method of integration.&#8221;</em></strong></p>
<p>While doing some digging I found that they were using a very old web submit method that Authorize.Net no longer supported.  There were two ways to fix the problem:</p>
<ol>
<li>Change to AIM method of submission, which required an SSL certificate that the client did not have.</li>
<li>Change to SIM method of submission, which required either PHP 5.1.2 installed to use the hash_hmac function, or for PHP 4.3.9 it required that mhash be installed on the server.</li>
</ol>
<p>Since the client did not want to spend the extra cash for the SSL certificate, and I could not install PHP 5.1.2 because I had too many other clients on the server that were not ready for the upgrade, I decided to do some searching for a way to install mhash.</p>
<p>It turned out that the Red Hat repositories did not carry php-mhash for RHEL 4, so this meant I needed to look in other areas.  After reading many different blog and BB postings saying that it required an install, then a recompile of PHP I started to get a little worried.  I did not look forward to recompiling PHP.</p>
<p>Finally I found some posts that brought a ray of hope.  There are RPMs available to install php-mhash without the PHP recompile, but it required that libmhash be installed first.  Here are the steps I followed:</p>
<ul>
<li>I went to <a href="http://dag.wieers.com/packages/libmhash/">http://dag.wieers.com/packages/libmhash/</a> and downloaded the newest version of libmhash for my server.</li>
<li>Then I installed using the following to satisfy dependencies of mhash:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm <span style="color: #660033;">-iv</span> libmhash-0.9.1-1.rhel3.dag.i386.rpm</pre></div></div>

</li>
<li>Next I downloaded the php-mhash by using:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>rpmfind.net<span style="color: #000000; font-weight: bold;">/</span>linux<span style="color: #000000; font-weight: bold;">/</span>sourceforge<span style="color: #000000; font-weight: bold;">/</span>p<span style="color: #000000; font-weight: bold;">/</span>ph<span style="color: #000000; font-weight: bold;">/</span>phprpms<span style="color: #000000; font-weight: bold;">/</span>php-mhash-4.3.2-19.ent.2.i386.rpm</pre></div></div>

</li>
<li>I followed that by installing it using:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm <span style="color: #660033;">-iv</span> php-mhash-4.3.2-19.ent.2.i386.rpm</pre></div></div>

</li>
</ul>
<p>After following those steps I created a phpinfo script to see that everything went well:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">phpinfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>I could now plainly see that mhash was installed perfectly, and with further tests I confirmed it was working.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=283</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ubuntu can mount ISO files, and IMG files after converting them to ISO</title>
		<link>http://www.geekyboy.com/?p=274</link>
		<comments>http://www.geekyboy.com/?p=274#comments</comments>
		<pubDate>Fri, 01 May 2009 20:13:15 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[burn to disk]]></category>
		<category><![CDATA[img]]></category>
		<category><![CDATA[iso]]></category>
		<category><![CDATA[mount]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=274</guid>
		<description><![CDATA[Today I needed to create an OEM Microsoft Office 2007 CD and found that I could download the disks directly from the Microsoft site.  However, the files that I downloaded were in IMG format.  At first I was puzzled, but quickly (via Google) found out that they were essentially ISO files.  However, [...]]]></description>
			<content:encoded><![CDATA[<p>Today I needed to create an OEM Microsoft Office 2007 CD and found that I could download the disks directly from the Microsoft site.  However, the files that I downloaded were in IMG format.  At first I was puzzled, but quickly (via Google) found out that they were essentially ISO files.  However, I did not quickly find anything in Ubuntu that would burn an IMG to disk.<br />
Diligent searching finally revealed that while there were not really ways to burn an IMG to disk, or mount an IMG file directly, there is a tool called ccd2iso that converts the IMG to ISO format.</p>
<p>First I had to install the ccd2iso package via Synaptic package manager, or I could have used &#8217;sudo apt install ccd2iso&#8217;.</p>
<p>After installing this I could simply run the following command from terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ccd2iso myfile.img myfile.iso</pre></div></div>

<p>The same methods can be used for other image type files:<br />
mdf2iso -> myfile.mdf<br />
nrg2iso -> myfile.nrg</p>
<p>Now I have a regular iso file that can be used to serve our purposes by burning to disk or mounting:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-o</span> loop myfile.iso mountname
&nbsp;
or
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-o</span> loop <span style="color: #660033;">-t</span> iso9660 myfile.iso mountname</pre></div></div>

<p>The .nrg files can also be mounted in this manner without converting to ISO by using:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-o</span> loop,<span style="color: #007800;">offset</span>=<span style="color: #000000;">307200</span> myfile.nrg mountname</pre></div></div>

<p>NOTE: if this doesn&#8217;t work and you get an error like: &#8220;Unrecognized sector mode (0) at sector 0!&#8221; it may be due to the limitations of the ccd2iso.  In my case the MS Office disk had multiple sessions, and I could not convert it to ISO.</p>
<p>Another post I found on Ubuntuforums said to try the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">growisofs <span style="color: #660033;">-dvd-compat</span> <span style="color: #660033;">-Z</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">dvdrw</span>=dvd.img</pre></div></div>

<p>Where /dev/dvdrw is your dvd/cd burner.</p>
<p>FOLLOWUP:<br />
The IMG file I had from Microsoft was a multi-session disk so I was not able to use the steps above.  However, when I simply changed the file extension to &#8216;.iso&#8217; it worked fine.  There seems to be very little difference between IMG and ISO.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=274</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finding a text string inside a file on a Linux server</title>
		<link>http://www.geekyboy.com/?p=269</link>
		<comments>http://www.geekyboy.com/?p=269#comments</comments>
		<pubDate>Wed, 29 Apr 2009 18:46:12 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[OS]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=269</guid>
		<description><![CDATA[It never fails that I find myself hunting for a way to search for a particular text string in files.  Usually I know the file, but often times I also find that I am completely unsure what file contains the string.  Or while I am writting some code I need to find how many files [...]]]></description>
			<content:encoded><![CDATA[<p>It never fails that I find myself hunting for a way to search for a particular text string in files.  Usually I know the file, but often times I also find that I am completely unsure what file contains the string.  Or while I am writting some code I need to find how many files use a certain function.</p>
<p>I know that using grep is the best way to search on a Linux server, so I start there.  Here is the command syntax:</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: #ff0000;">&quot;text string to search for&quot;</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>search</pre></div></div>

<p><strong>Examples</strong><br />
To search for a string called &#8220;myFunction&#8221; in all text files located in /var/www/html/*.php use:</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: #ff0000;">&quot;myFunction&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/*</span>.php</pre></div></div>

<p>To search recursively in all sub-directories you would alter the command by adding the -r option:</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;myFunction&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html</pre></div></div>

<p>Now you have probably noticed that grep prints out the matching lines containing your string, but you may also need the filenames of the files containing the string instead.  You can use the -H option to narrow the output the filename followed by the line containing your search string, like so:</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;">-H</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;myFunction&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html</pre></div></div>

<p>This would output something like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...
your_file.php: line containing myFunction
..</pre></div></div>

<p>To print out just the filename you can cut command like this to clean the output further: (Note the one after the f, not an L)</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;">-H</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;myFunction&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> -d: <span style="color: #660033;">-f1</span></pre></div></div>

<p>The new cleaner out put would be like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...
your_file.php
...</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=269</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Backup files from Linux to a Windows server</title>
		<link>http://www.geekyboy.com/?p=200</link>
		<comments>http://www.geekyboy.com/?p=200#comments</comments>
		<pubDate>Sat, 18 Apr 2009 22:04:47 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Backup]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Remote Backup]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[samba]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=200</guid>
		<description><![CDATA[Ok, this may be my last disaster recovery and backup blog for a long time.  As you can probably tell from the title this blog entry is all about keeping backup strategies as cheap as possible.
My strategy is to backup all of my Windows and Linux servers to one central Windows server that is [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, this may be my last disaster recovery and backup blog for a long time.  As you can probably tell from the title this blog entry is all about keeping backup strategies as cheap as possible.</p>
<p>My strategy is to backup all of my Windows and Linux servers to one central Windows server that is running a Tivoli backup agent.  All of my servers are hosted elsewhere, and since it costs $99.00 per server to backup I am getting the most for my money by only backing a single server to tape/SAN.  However that single server carries all of the files that need to be remotely backed up to tape/SAN.</p>
<p>My earlier posts show how to backup the Windows servers:<br />
<a href="http://www.geekyboy.com/archives/160">Windows backup bat script using xcopy</a></p>
<p>Also, how to backup the Windows Domain Controller:<br />
<a href="http://www.geekyboy.com/archives/169">Backup Windows Domain Controller using NTBACKUP via cmd</a></p>
<p>And I also showed how to backup a Linux server to a local file:<br />
<a href="http://www.geekyboy.com/archives/184">Linux backup using CRON to local directory</a></p>
<p>Now I will show how I moved the files backed up on the Linux servers to the Windows server prior to tape/SAN backup.  I have decided to use Samba and mount a directory pointing to a shared folder on the Windows server.  Lets begin:<br />
<span id="more-200"></span></p>
<ol>
<li>Create a share on the Windows server to use as your backup location.</li>
<li>Create a user to use this share, and give the user permissions to use it.</li>
<li>Pick, or create, a user that you&#8217;re going to use to backup the files.  Log in as this user and type &#8216;id&#8217; to get the numeric ID of the user in the Linux OS. (You will need it later.)</li>
<li>Become &#8216;root&#8217;. (This will enable you to perform the next tasks without problems.)</li>
<li>Install samba and samba-client if they are not installed yet.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> samba
yum <span style="color: #c20cb9; font-weight: bold;">install</span> samba-client</pre></div></div>

<p>You will need to answer &#8216;y&#8217; to when prompted.</li>
<li>By default only the root user can mount or unmount a cifs, so we must open it to other users.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">4755</span> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>mount.cifs
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">4755</span> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>umount.cifs</pre></div></div>

</li>
<li>Now we need to make a directory to use as our mount point.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sharename</pre></div></div>

</li>
<li>To enable our desired user to mount and unmount this we need to assign ownership to that user. Changing permissions with chmod is not enough.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chown</span> userfrom<span style="color: #666666; font-style: italic;">#1 /mnt/sharename</span></pre></div></div>

</li>
<li>Now we need to edit the /etc/fstab file and add an entry.  Replace the user ID of 500 with your user ID from #1.  Replace sharename with your Windows share name.  Replace WINDOWSHOST with your hostname or IP address.  If you don&#8217;t know the shares run smbclient -L WINDOWSHOST

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">//</span>WINDOWSHOST<span style="color: #000000; font-weight: bold;">/</span>sharename <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sharename cifs <span style="color: #007800;">credentials</span>=<span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>smblogin,<span style="color: #007800;">uid</span>=<span style="color: #000000;">500</span>,noauto,user <span style="color: #000000;">0</span> <span style="color: #000000;">0</span></pre></div></div>

</li>
<li>Create/Edit a file /root/smblogin and put the following two lines in it.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">username</span>=WINDOWS USERNAME
<span style="color: #007800;">password</span>=WINDOWS PASSWORD</pre></div></div>

</li>
<li>Now we must give our user from #1 access to the file, but still protect it.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chown</span> userfrom<span style="color: #666666; font-style: italic;">#1 /root/smblogin</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">600</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>smblogin</pre></div></div>

</li>
<li>If you have IPTABLES active on your server you will need to make sure to add a policy to allow OUTPUT port 445.</li>
<li>Log in as the user from #1</li>
<li>Try to mount the share:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sharename
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-la</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sharename
<span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sharename</pre></div></div>

</li>
<li>If that was successful you are now ready to write a script that will automate the moving of your backup files from the Linux to the Windows share. (Script/File = backup.sh)

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sharename
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-r</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>file.tar.gz <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sharename<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>file.tar.gz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sharename</pre></div></div>

<p>Of course you can add this to the end of the file described in <a href="http://www.geekyboy.com/archives/184">Linux backup using CRON to local directory</a> which would create a complete solution for backing up files, then relocating them to a remote Windows server.</li>
<li>Next you will add an entry to the crontab of the user from #1 to happen automagically.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">crontab <span style="color: #660033;">-e</span> <span style="color: #660033;">-u</span> userfrom<span style="color: #666666; font-style: italic;">#1</span></pre></div></div>

</li>
<li>Enter this into the crontab.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Backup at 1:00 A.M. every day. Call 'man 5 crontab' for more information</span>
<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1</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>backup.sh</pre></div></div>

</li>
</ol>
<p>Now once this is all done you can rest a little bit easier knowing that your servers are backed up.  I hear the beach calling me now&#8230;.ttyl.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=200</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Linux backup using CRON to local directory</title>
		<link>http://www.geekyboy.com/?p=184</link>
		<comments>http://www.geekyboy.com/?p=184#comments</comments>
		<pubDate>Fri, 17 Apr 2009 19:15:26 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Backup]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=184</guid>
		<description><![CDATA[As many have pointed out I am on a backup and disaster recovery kick lately.  Some would say that it is about time, others are simply glad to see that data is now being backed up.  I have found that it is easiest to zip up files on a local machine prior to [...]]]></description>
			<content:encoded><![CDATA[<p>As many have pointed out I am on a backup and disaster recovery kick lately.  Some would say that it is about time, others are simply glad to see that data is now being backed up.  I have found that it is easiest to zip up files on a local machine prior to moving them to a final destination.  So lets get started:</p>
<p>I have multiple Linux servers with many websites on each, as well as database.  So I created a script that simply tar&#8217;s the files, then gzips them with the date in the filename for archiving.</p>
<p>Here is the file named &#8216;backupall.sh&#8217; that I save in a place reachable by the user I will use to schedule this cronjob:</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>
<span style="color: #c20cb9; font-weight: bold;">date</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;############### Backing up files on the system... ###############&quot;</span>
&nbsp;
<span style="color: #007800;">backupfilename</span>=server_file_backup_<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #ff0000;">'+%Y-%m-%d'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;----- First do the sql by deleting the old file and dumping the current data -----&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>backup.sql
mysqldump <span style="color: #660033;">--user</span>=mysqluser <span style="color: #660033;">--password</span>=password <span style="color: #660033;">--all-databases</span> <span style="color: #660033;">--add-drop-table</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>backup.sql
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;----- Now tar, then zip up all files to be saved -----&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> cvf <span style="color: #000000; font-weight: bold;">/</span>directory<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>store<span style="color: #000000; font-weight: bold;">/</span>file<span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${backupfilename}</span>.tar <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>httpd.conf <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>backup.sql <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/*</span>
<span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #000000; font-weight: bold;">/</span>directory<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>store<span style="color: #000000; font-weight: bold;">/</span>file<span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${backupfilename}</span>.tar
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>directory<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>store<span style="color: #000000; font-weight: bold;">/</span>file<span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${backupfilename}</span>.tar
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">666</span> <span style="color: #000000; font-weight: bold;">/</span>directory<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>store<span style="color: #000000; font-weight: bold;">/</span>file<span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${backupfilename}</span>.tar.gz
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;############### Completed backing up system... ###############&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">date</span></pre></div></div>

<p><span id="more-184"></span></p>
<p>As you can see by the tar line I am backing up:</p>
<ul>
<li>The home directory so all users data is backed up.</li>
<li>The html directory where all web sites reside.</li>
<li>My subversion(svn) directory where all of my version control repositories reside because losing them would mean losing years of historical data.</li>
<li>My php.ini</li>
<li>The apache configuration file</li>
<li>The sql file with the database backup created earlier in the script.</li>
<li>Last my trac settings, that house all of my project related history.</li>
</ul>
<p>All of these will be saved in a tar file that I then zip using gzip, and store in a directory somewhere.  Finally I then set the files permissions to 666 which allows pretty much any user copy it to another location for remote backup.</p>
<p>You may also notice that I put &#8216;date&#8217; at the beginning and end of the backupall.sh file.  This echos out the date and time so that I can see the time when the job started and ended.</p>
<p>The script above should be saved somewhere, and then executed via CRON.  Here is how I set up my crontab to handle that by using the command &#8220;crontab -e&#8221;. (Alternatively you can use &#8220;crontab -e -u anotheruser&#8221; to have the task added to a user other than the one you are logged on with. Many will add this to the root users crontab.)</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;">1</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> backupall.sh</pre></div></div>

<p>This line in the crontab tells CRON to run this script every day at 1:00AM.</p>
<p><strong>Logging the output from CRON to a file.</strong><br />
If I desired to keep a log of the events it would be nice to output the feedback from the backupall.sh to a file and use it as a log.  I can do this by creating a file to use as a log file, and changing the owner of the file to be the cronjob user that is executing backupall.sh:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">touch</span> backup_log.txt
<span style="color: #c20cb9; font-weight: bold;">chown</span> cronjobuser backup_log.txt</pre></div></div>

<p>And then editing the crontab line to be as follows:</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;">1</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> backupall.sh <span style="color: #000000; font-weight: bold;">&gt;</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>backup_log.txt <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span></pre></div></div>

<p>Note that the cronjob line above will not append to the log file, but will clear it and then write the current contents to it.  If you wish to append to the file like a true log file you can use >> instead of the single > making the crontab look like this:</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;">1</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> backupall.sh <span style="color: #000000; font-weight: bold;">&gt;&gt;</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>backup_log.txt <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span></pre></div></div>

<p>To see how I remotely backup this file please see my other post at: <a href="http://www.geekyboy.com">Geekyboy.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=184</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup Windows Domain Controller using NTBACKUP via cmd</title>
		<link>http://www.geekyboy.com/?p=169</link>
		<comments>http://www.geekyboy.com/?p=169#comments</comments>
		<pubDate>Fri, 17 Apr 2009 01:55:06 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Scheduled Tasks]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[domain controller]]></category>
		<category><![CDATA[ntbackup]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=169</guid>
		<description><![CDATA[Backing up your servers for disaster recovery these days much include your Domain Controller if you are utilizing a Windows Active Directory to manage your users.  To do this is easy using a tool that comes installed on all Windows servers called NTBACKUP.  Of course you can launch the GUI by entering NTBACKUP [...]]]></description>
			<content:encoded><![CDATA[<p>Backing up your servers for disaster recovery these days much include your Domain Controller if you are utilizing a Windows Active Directory to manage your users.  To do this is easy using a tool that comes installed on all Windows servers called NTBACKUP.  Of course you can launch the GUI by entering NTBACKUP from the run or command line.  However, this does not make automated backup work very well.  So here is the .bat file that I use to execute it via Windows Scheduled tasks:</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: #7a0874; font-weight: bold;">echo</span> off
:: variables
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">logfile</span>=D:\backup_log_file.txt
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000; font-weight: bold;">%</span>Date<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #666666; font-style: italic;"># # # Backing up system state containing: local Registry, COM+ Class Registration Database, System Boot Files, Certificates(if certificate server installed), Cluster database(if installed), NTDS.DIT, and SYSVOL folder &gt;&gt; %logfile%</span>
ntbackup backup systemstate <span style="color: #000000; font-weight: bold;">/</span>J <span style="color: #ff0000;">&quot;System State Backup Job&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>F <span style="color: #ff0000;">&quot;D:\system_state_backup.bkf&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">%</span>logfile<span style="color: #000000; font-weight: bold;">%</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000; font-weight: bold;">%</span>Date<span style="color: #000000; font-weight: bold;">%</span> Backup Completed<span style="color: #000000; font-weight: bold;">!</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">%</span>logfile<span style="color: #000000; font-weight: bold;">%</span></pre></div></div>

<p>(NOTE: I am doing this backup via an internal network and using a user account that exists on both systems.  Security may dictate that you handle this differently based on your circumstances.)</p>
<p>After the file is executed by Windows Scheduled Tasks you will then be left with a file that is ready to backup somewhere.  I do this by making a copy to another server by using the methods covered in a previous blog post at <a href="http://www.geekyboy.com/archives/160">Windows backup bat script using xcopy</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=169</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows backup bat script using xcopy</title>
		<link>http://www.geekyboy.com/?p=160</link>
		<comments>http://www.geekyboy.com/?p=160#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:15:25 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[Scheduled Tasks]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[xcopy]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=160</guid>
		<description><![CDATA[Recently I had the need to create a bat script that could be executed by the Windows Scheduled Tasks.  The purpose was to copy files from one server to another as a cheap way to backup files created by MSSQL backing up the databases.  Here is the .bat file contents (cleaned up to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had the need to create a bat script that could be executed by the Windows Scheduled Tasks.  The purpose was to copy files from one server to another as a cheap way to backup files created by MSSQL backing up the databases.  Here is the .bat file contents (cleaned up to protect sensitive data):</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: #7a0874; font-weight: bold;">echo</span>
:: variables
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">sourcedrive</span>=D:\
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">backupdrive</span>=\\servername\d$
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">backupcmd</span>=xcopy <span style="color: #000000; font-weight: bold;">/</span>s <span style="color: #000000; font-weight: bold;">/</span>c <span style="color: #000000; font-weight: bold;">/</span>d <span style="color: #000000; font-weight: bold;">/</span>e <span style="color: #000000; font-weight: bold;">/</span>h <span style="color: #000000; font-weight: bold;">/</span>i <span style="color: #000000; font-weight: bold;">/</span>r <span style="color: #000000; font-weight: bold;">/</span>y
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #666666; font-style: italic;"># # # Moving files</span>
<span style="color: #000000; font-weight: bold;">%</span>backupcmd<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #ff0000;">&quot;%sourcedrive%\directory_to_backup&quot;</span> <span style="color: #ff0000;">&quot;%backupdrive%\directory_to_store_backup&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #666666; font-style: italic;"># # Moveing Complete!</span></pre></div></div>

<p>(NOTE: I am doing this backup via an internal network and using a user account that exists on both systems.  Security may dictate that you handle this differently based on your circumstances.)</p>
<p>Notice that for the backupdrive I am calling another Windows server and using the d$.  This would require that the Windows Scheduled Task be executed using a user that is trusted on both machines.  Also you could specify a local directory on the same server if you did not need to copy the files to another server.<br />
<span id="more-160"></span><br />
If I were executing this via Window Scheduled Tasks there is nowhere for me to see what happened, what files were moved, etc.  This can be solved by adding the following line in the variables area specifying a log file to capture all output that would normally be seen via command line:</p>

<div class="wp_syntax"><div class="code"><pre class="bat" style="font-family:monospace;">set logfile=D:\backup_log_file.txt</pre></div></div>

<p>Then I would append &#8220;>> %logfile%&#8221; to the end of each line so that it would be added to the log file.  In addition I could prepend &#8220;%Date%&#8221; after echo on each line to date stamp each line.</p>
<p>Here is what the final file with these two additions would look like:</p>

<div class="wp_syntax"><div class="code"><pre class="bat" style="font-family:monospace;">@echo
:: variables
set sourcedrive=D:\
set backupdrive=\\servername\d$
set backupcmd=xcopy /s /c /d /e /h /i /r /y
set logfile=D:\backup_log_file.txt
&nbsp;
echo %Date% # # # Moving files &gt;&gt; %logfile%
%backupcmd% &quot;%sourcedrive%\directory_to_backup&quot; &quot;%backupdrive%\directory_to_store_backup&quot; &gt;&gt; %logfile%
&nbsp;
echo %Date% # # Moveing Complete! &gt;&gt; %logfile%</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=160</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UltraEdit on Linux and MAC&#8230;finally ! ! !</title>
		<link>http://www.geekyboy.com/?p=156</link>
		<comments>http://www.geekyboy.com/?p=156#comments</comments>
		<pubDate>Tue, 10 Mar 2009 14:27:25 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Linux application]]></category>
		<category><![CDATA[UltraEdit]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=156</guid>
		<description><![CDATA[I received an email that just made my day.  It was the announcement that UltraEdit will finally be available on Linux!  The screenshots show it on Ubuntu, and they say there will also be a version for MAC. (Initially it will only be packaged for Ubuntu with tar balls for the others, but [...]]]></description>
			<content:encoded><![CDATA[<p>I received an email that just made my day.  It was the announcement that UltraEdit will finally be available on Linux!  The screenshots show it on Ubuntu, and they say there will also be a version for MAC. (Initially it will only be packaged for Ubuntu with tar balls for the others, but soon there will also be packages for Suse, and Redhat)  And it is very close to release, supposedly Alpha in April 2009.</p>
<div id="attachment_157" class="wp-caption alignnone" style="width: 310px"><a href="http://www.geekyboy.com/wp-content/uploads/2009/03/uexsplash.jpg"><img src="http://www.geekyboy.com/wp-content/uploads/2009/03/uexsplash-300x151.jpg" alt="UltraEdit on Ubuntu" title="UltraEdit on Ubuntu" width="300" height="151" class="size-medium wp-image-157" /></a><p class="wp-caption-text">UltraEdit on Ubuntu</p></div>
<p>You can find out more on the <a href="http://www.ultraedit.com/company/blog/products/uex_development_update-3-09-09.html">Blog Post</a>, or you can see the <a href="http://www.ultraedit.com/products/uex.html">Formal Product Page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=156</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redhat, Plesk, named, and chroot oh my!</title>
		<link>http://www.geekyboy.com/?p=154</link>
		<comments>http://www.geekyboy.com/?p=154#comments</comments>
		<pubDate>Sun, 11 Jan 2009 21:03:20 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[OS]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[named]]></category>
		<category><![CDATA[redhat]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=154</guid>
		<description><![CDATA[Well once again I performed my updates via Redhat up2date, and once again I lost all name services on a server.  This time I thought I would post my fix, since it was the same as last time.
There was an update issued by RHN this evening which updated the bind-chroot rpm. As part of it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Well once again I performed my updates via Redhat up2date, and once again I lost all name services on a server.  This time I thought I would post my fix, since it was the same as last time.</p>
<p>There was an update issued by RHN this evening which updated the bind-chroot rpm. As part of it&#8217;s post install script it will attempt to relocate any zone files that may be located outside of the chroot into a chrooted directory in /var/named/chroot.</p>
<p>Since PSA implements a chroot for named outside of this package the nameserver files will be relocated to a path like&#8230;</p>
<p>/var/named/chroot/var/named/run-root/var/named/</p>
<p>This will of course break named&#8217;s ability to startup.</p>
<p>simply remove the bind-chroot rpm and re-link the /etc/named.conf file to the right location.</p>
<p>rpm -e bind-chroot<br />
ln -sf /var/named/run-root/etc/named.conf /etc/named.conf<br />
/sbin/service named restart</p>
<p>You should be good to go at that point.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=154</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get SSL running on Apache (CentOS)</title>
		<link>http://www.geekyboy.com/?p=142</link>
		<comments>http://www.geekyboy.com/?p=142#comments</comments>
		<pubDate>Thu, 04 Dec 2008 02:24:57 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=142</guid>
		<description><![CDATA[I was playing with a new virtual server that had CentOS installed on it recently, and wanted to get SSL working for Apache.  Since I was only setting up a development server I really didn&#8217;t need to purchase a certificate and decided to use a self-signed certificate.  Here is what I did:
First I needed to [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing with a new virtual server that had CentOS installed on it recently, and wanted to get SSL working for Apache.  Since I was only setting up a development server I really didn&#8217;t need to purchase a certificate and decided to use a self-signed certificate.  Here is what I did:</p>
<p>First I needed to get &#8216;make&#8217; and &#8216;mod_ssl&#8217; running to allow for this. (I use <code>sudo</code> but you could login as <code>su</code>)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> yum <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">make</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;">sudo</span> yum <span style="color: #c20cb9; font-weight: bold;">install</span> mod_ssl</pre></div></div>

<p>Next I did the following steps:</p>
<ol>
<li>Go to <code>/etc/pki/tls/certs</code></li>
<li>Run the command <code>sudo make mycert.pem</code></li>
<li>Enter the information you are prompted for about country, state, city, host name etc, your certificate and key has been created</li>
<li>Now edit <code>/etc/httpd/conf.d/ssl.conf</code> and update the following items:</li>
<ul>
<li><code>SSLCACertificateFile /etc/pki/tls/certs/mycert.pem</code></li>
<li><code>SSLCACertificateKeyFile /etc/pki/tls/mycert.pem</code></li>
</ul>
<li>I was forced to create a symbolic link for the SSLCACertificateKeyFile as follows: (I think this was supposed to happen automagically.)</li>
<ul>
<li>I went to <code>/etc/pki/tls</code> and created the symbolic link using the next line.</li>
<li><code>sudo ln -s certs/mycert.pem mycert.pem</code></li>
</ul>
<li>Restart Apache (<code>/etc/init.d/httpd restart</code>)</li>
</ol>
<p>There, now you have a self-signed certificate for your apache virtualhosts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=142</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TinyMCE URL rewrite problem editing emails (kinda solved)</title>
		<link>http://www.geekyboy.com/?p=136</link>
		<comments>http://www.geekyboy.com/?p=136#comments</comments>
		<pubDate>Wed, 12 Nov 2008 14:49:40 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tinymce]]></category>
		<category><![CDATA[convert_urls]]></category>
		<category><![CDATA[relative_urls]]></category>
		<category><![CDATA[textfield]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=136</guid>
		<description><![CDATA[TinyMCE has a habit of rewriting the URL for images, etc.  However, this becomes broken when using TinyMCE to edit things like emails.  The relative path is totally useless in an email because the email is not being viewed from the server like a webpage would be.
To fix this I searched the tiny_mcs.js and found [...]]]></description>
			<content:encoded><![CDATA[<p>TinyMCE has a habit of rewriting the URL for images, etc.  However, this becomes broken when using TinyMCE to edit things like emails.  The relative path is totally useless in an email because the email is not being viewed from the server like a webpage would be.</p>
<p>To fix this I searched the tiny_mcs.js and found that TinyMCE had <strong>two</strong> settings in the tiny_mce.js file that are boolean flags (true,false or 0,1) dealing with URL&#8217;s. The variables are <em><strong>relative_urls</strong></em> and <em><strong>convert_urls</strong></em>, and by default they are set to true, or 1.</p>
<p>After changing these setting to false (or zero) I have not had any further problems with using TinyMCE to edit email content.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=136</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hard disk usage from command line on Linux</title>
		<link>http://www.geekyboy.com/?p=133</link>
		<comments>http://www.geekyboy.com/?p=133#comments</comments>
		<pubDate>Mon, 13 Oct 2008 19:41:56 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[disk usage]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=133</guid>
		<description><![CDATA[From the command line I have found many great tools for system management, but really needed to dig into ways of tracking hard disk usage on Linux without the aid of GUI tools.  Google to the rescue!  I found a few places with great tips and hints on how to do this, but [...]]]></description>
			<content:encoded><![CDATA[<p>From the command line I have found many great tools for system management, but really needed to dig into ways of tracking hard disk usage on Linux without the aid of GUI tools.  Google to the rescue!  I found a few places with great tips and hints on how to do this, but one article on Linux.com came in very handy.  Here were my findings:</p>
<p>The <code>df</code> utility displays the disk space usage on all mounted filesystems. The <code>-T</code> option prints the filesystem type as well. By default, <code>df</code> measures the size in 1K blocks, which could be a little difficult for a desktop user to decipher. Use the <code>-h</code> option to get more understandable output:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-h</span> <span style="color: #660033;">-T</span>
Filesystem    Type    Size  Used Avail Use<span style="color: #000000; font-weight: bold;">%</span> Mounted on
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda6     ext3     20G  9.3G  9.1G  <span style="color: #000000;">51</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>dev<span style="color: #000000; font-weight: bold;">/</span>hda7 reiserfs     13G  2.1G   11G  <span style="color: #000000;">17</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>suse
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda1     vfat    241M  152M   90M  <span style="color: #000000;">63</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>usbdisk</pre></div></div>

<p>You can use the <code>du</code> command to determine which files or directories need to be deleted &#8212; or at least trimmed. A simple <code>du</code> will print usage for the present working directory and its subdirectories, along with the size of each directory.</p>
<p>If you want the size of an particular directory, specify it with <code>du directoryname</code>. For instance, <code>du -h /home/bodhi/podcasts</code> will print the size of the podcasts directory in a more readable format than the kilobytes used by default. The <code>-c</code> option prints the grand total size of the directory at the end. The <code>-a</code> option also displays the file names along with directories and can be of use when you want to see a list of files in a particular directory. The <code>-s</code> option will display a summary, without showing all of the subdirectories.</p>
<p>Running <code>du -ch | grep total</code> prints just one line with the total size of the directory. If there&#8217;s a particular type of file that you would like to be excluded while calculating a directory&#8217;s usage, specify it with the <code>--exclude=type</code> option. Here we&#8217;ll check the disk usage of the current directory, and display all file names with their disk usage, and then sort them numerically using the sort utility:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-ah</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-n</span>
4.2M    .<span style="color: #000000; font-weight: bold;">/</span>eweek.10.28.05.mp3
4.5M    .<span style="color: #000000; font-weight: bold;">/</span>LQ-Podcast-101105.mp3
4.8M    .<span style="color: #000000; font-weight: bold;">/</span>LQ-Podcast-110905.mp3
19M     .<span style="color: #000000; font-weight: bold;">/</span>LQRadio-Episode3.mp3
20M     .<span style="color: #000000; font-weight: bold;">/</span>LQRadio-Searls.mp3
36M     .<span style="color: #000000; font-weight: bold;">/</span>LQRadio-HiserAndAdelstein.mp3
197M    .</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=133</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Background image generator &#8211; BgPatterns.com</title>
		<link>http://www.geekyboy.com/?p=127</link>
		<comments>http://www.geekyboy.com/?p=127#comments</comments>
		<pubDate>Fri, 19 Sep 2008 15:19:53 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[saas]]></category>
		<category><![CDATA[web tools]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=127</guid>
		<description><![CDATA[After Ian posted this on his blog I thougth I would follow suit. (He always seems to find the cool stuff.)
This very nifty site allows you to create tiled background images for use wherever you may need them.  At first I thought &#8220;yuck, I stopped using backgrounds long ago&#8221;.  But after playing with [...]]]></description>
			<content:encoded><![CDATA[<p>After Ian posted this on <a href="http://www.gen-x-design.com">his blog</a> I thougth I would follow suit. (He always seems to find the cool stuff.)</p>
<p>This very nifty site allows you to create tiled background images for use wherever you may need them.  At first I thought &#8220;yuck, I stopped using backgrounds long ago&#8221;.  But after playing with rotation, colors, and opacity I found that a pretty nice tiled background can be useful when applied right.</p>
<p>It is very difficult to do a good job on tiled backgrounds, but this site makes it easy.<br />
<a href="http://www.bgpatterns.com">www.BgPatterns.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=127</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL not creating mysql.sock and broken on Hardy Heron</title>
		<link>http://www.geekyboy.com/?p=122</link>
		<comments>http://www.geekyboy.com/?p=122#comments</comments>
		<pubDate>Sat, 13 Sep 2008 20:29:57 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[hardy heron]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql.sock]]></category>
		<category><![CDATA[symbolic link]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=122</guid>
		<description><![CDATA[Recently I started receiving errors when I tried to connect to MySQL using command line or PHPMyAdmin.  In command line I would get &#8220;ERROR 2002 (HY000): Can&#8217;t connect to local MySQL server through socket &#8216;/tmp/mysql.sock&#8217; (2)&#8221;, and with PHPMyAdmin I would get &#8220;#2002 &#8211; The server is not responding (or the local MySQL server&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I started receiving errors when I tried to connect to MySQL using command line or PHPMyAdmin.  In command line I would get &#8220;ERROR 2002 (HY000): Can&#8217;t connect to local MySQL server through socket &#8216;/tmp/mysql.sock&#8217; (2)&#8221;, and with PHPMyAdmin I would get &#8220;#2002 &#8211; The server is not responding (or the local MySQL server&#8217;s socket is not correctly configured)&#8221;.</p>
<p>The system in question is my Dell Inspiron 1720 running Hardy Heron Ubuntu.  I knew of a few changes to my system, but none of them seemed to have caused the problem.  So I hunted for a few days trying to figure it out.  I performed multiple searches on the net, and each led me to a dead end.  Many said, &#8220;Set this &#8230; in your php.ini&#8221; or &#8220;Set that &#8230; in your my.cnf&#8221;, and some even said Apache was to blame.  However, I found the solution to be very simple.</p>
<p>MySQL was expecting the mysql.sock to be located in &#8216;/tmp/mysql.sock&#8217;.  However, for some reason it had moved or the symbolic link to it&#8217;s actual location was deleted by some update or install I did recently.</p>
<p>I fixed the problem by adding a symbolic link to the actual home of mysqld.sock, which was /var/run/mysqld/mysqld.sock.  Here is how I created the symbolic link: (at the command line)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>mysqld<span style="color: #000000; font-weight: bold;">/</span>mysqld.sock <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>mysql.sock</pre></div></div>

<p>sudo puts us in super user mode, &#8220;ln -s&#8221; creates a symbolic link followed by the target the links sould point to and last by the location of the link.</p>
<p><strong>Edited on Sep. 26th with update below:</strong></p>
<p>The fix above did not work as a permanent fix.  I found that whenever I rebooted the OS it forced me to recreate the symbolic link.  MySQL was failing to recreate the symbolic link on it&#8217;s own.  To permanently fix the issue I needed to add the creation of the symbolic link to my SESSION startup.  Here is how I did that:</p>
<p>By going to the System->Preferences->Sessions to edit the Startup Programs.  I added an item that automatically issues the command above, but without the &#8220;sudo&#8221;.</p>
<p>Mission accomplished&#8230;permanently.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=122</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ubuntu Hardy Heron sound broken</title>
		<link>http://www.geekyboy.com/?p=118</link>
		<comments>http://www.geekyboy.com/?p=118#comments</comments>
		<pubDate>Wed, 03 Sep 2008 13:35:22 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[alsa]]></category>
		<category><![CDATA[hardy heron]]></category>
		<category><![CDATA[inspiron]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=118</guid>
		<description><![CDATA[Recently I was having a consistent problem with the sound on my Dell Inspiron 1720, which is running on Ubuntu Hardy Heron.  It would consistently stop working all together, and I had a terrible time finding the cause of the problem.  If I viewed a flash video on the web, the sound would [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was having a consistent problem with the sound on my Dell Inspiron 1720, which is running on Ubuntu Hardy Heron.  It would consistently stop working all together, and I had a terrible time finding the cause of the problem.  If I viewed a flash video on the web, the sound would die afterwards.  If I listened to streaming Internet radio, the sound would die.  If I received an emial or IM the sound would die.</p>
<p>Finally it dawned on me, and I am not sure why or how.  But a few weeks prior I had been toying with a Bluetooth stereo headset and had turned on the Audio service in the Bluetooth manager on the services tab.</p>
<p><strong>Problem fixed:</strong> I simply turned off the Audio service in the Bluetooth manager, and all is working normally again.  However, if I ever need the Audio service I suppose it will break my sound.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=118</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hiding an email address using Javascript</title>
		<link>http://www.geekyboy.com/?p=48</link>
		<comments>http://www.geekyboy.com/?p=48#comments</comments>
		<pubDate>Fri, 29 Aug 2008 15:18:02 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web tools]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=48</guid>
		<description><![CDATA[Have you ever wondered why you suddenly started getting tons of spam?
Do you have, or did you recently post your email address on a website?
Then the reason is probably because you did not properly protect the email address, and spammers get most email addresses from robot script that harvest email addresses from websites.  It [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wondered why you suddenly started getting tons of spam?</p>
<p>Do you have, or did you recently post your email address on a website?</p>
<p>Then the reason is probably because you did not properly protect the email address, and spammers get most email addresses from robot script that harvest email addresses from websites.  It is pretty simple really.  The robot script hits the largest search engines for certain key words or phrases, to help the spammer hit the most relevent email addresses, and then systematically follows the links to websites.  Once the robot gets to the website it then searches all links on the page.  Each link it finds on the page that is a &#8220;mailto:&#8221; is an email address, and in a matter of minutes a robot script can harvest hundreds of emails.</p>
<p>So now you are asking, &#8220;What can be done to protect me from these vile robots?&#8221;.  Well that answer is also simple.  Most robot script are not smart enough, yet, to search Javascript code that scrambles an email address and form it back into a valid email address.  So here is how to do it:</p>
<p>First, you need to go into the HTML code and insert the Javascript as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> theuser <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;username&quot;</span> <span style="color: #006600; font-style: italic;">// change this to be the username, or portion of the email to the left of the @</span>
<span style="color: #003366; font-weight: bold;">var</span> thehost <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;your-domain.com&quot;</span> <span style="color: #006600; font-style: italic;">// change this to be your domain name</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> themessage <span style="color: #339933;">=</span> theuser <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;@&quot;</span> <span style="color: #339933;">+</span> thehost<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Now we tell Javascript to bring the pieces of the email address together visually on the screen as a link</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;a href=&quot;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;mail&quot;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;to:&quot;</span> <span style="color: #339933;">+</span> theuser <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;@&quot;</span> <span style="color: #339933;">+</span> thehost <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&gt;&quot;</span> <span style="color: #339933;">+</span> themessage <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&lt;/a&gt;&quot;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Note: Be sure to substitute <code>username</code> and <code>your-domain.com</code> with your own information.</p>
<p>Now when you view your webpage in your favorite browser (<a href="http://www.getfirefox.com">Firefox</a>) you will see the email as a link like you wanted, and the robots will see a bunch of code that most of them cannot form into a valid email address.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=48</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH port forwarding/tunneling for MySQL connection</title>
		<link>http://www.geekyboy.com/?p=47</link>
		<comments>http://www.geekyboy.com/?p=47#comments</comments>
		<pubDate>Wed, 02 Jan 2008 22:09:50 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[openssh]]></category>
		<category><![CDATA[port forwarding]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh tunnel]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/archives/47</guid>
		<description><![CDATA[Create an account on the remote MySQL database server.

useradd -s /bin/false remote_user
mkdir /home/remote_user/.ssh
touch /home/remote_user/.ssh/authorized_keys
chown -R remote_user:remote_user /home/remote_user/.ssh
chmod 755 /home/remote_user/.ssh
chmod 600 /home/remote_user/.ssh/authorized_keys

Add MySQL permissions in the remote MySQL database to allow user connections from localhost.

USE mysql;
GRANT ALL ON db.* TO database_user@127.0.0.1 IDENTIFIED BY 'database_pass';
FLUSH PRIVILEGES;

Now, on the local server (as root) create an RSA key pair [...]]]></description>
			<content:encoded><![CDATA[<p>Create an account on the remote MySQL database server.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">useradd <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> remote_user
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> remote_user:remote_user <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">600</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys</pre></div></div>

<p>Add MySQL permissions in the remote MySQL database to allow user connections from localhost.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">USE</span> mysql;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">ALL</span> <span style="color: #993333; font-weight: bold;">ON</span> db<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> database_user@127<span style="color: #66cc66;">.</span>0<span style="color: #66cc66;">.</span>0<span style="color: #66cc66;">.</span>1 <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'database_pass'</span>;
<span style="color: #993333; font-weight: bold;">FLUSH</span> PRIVILEGES;</pre></div></div>

<p>Now, on the local server (as root) create an RSA key pair to avoide the need for passwords for remote_user. (Simply hit enter for each question encountered.)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> rsa</pre></div></div>

<p>Now transfer the public key file to the remote server from your local server.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub root<span style="color: #000000; font-weight: bold;">@</span>remote_server.com:<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>local_server.local_rsa.pub
<span style="color: #c20cb9; font-weight: bold;">ssh</span> remote_server.com
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>local_server.local_rsa.pub <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys</pre></div></div>

<p>On the local server, create an SSH tunnel to the remote MySQL database server using the following command.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-fNg</span> <span style="color: #660033;">-L</span> <span style="color: #000000;">3306</span>:127.0.0.1:<span style="color: #000000;">3306</span> remote_user<span style="color: #000000; font-weight: bold;">@</span>remote_server.com <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">9999</span></pre></div></div>

<p>To use this from PHP you would simply do this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$remote_server_mysql</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;database_user&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;database_pass&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;database&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$remote_server_mysql</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=47</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using the UNIX tail -f command to watch log files</title>
		<link>http://www.geekyboy.com/?p=46</link>
		<comments>http://www.geekyboy.com/?p=46#comments</comments>
		<pubDate>Tue, 04 Dec 2007 20:26:12 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[OS]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[log file]]></category>
		<category><![CDATA[tail]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/archives/46</guid>
		<description><![CDATA[When troubleshooting a problem in Apache it is a pain to open the log file, find an error, close the log file, and then open it again after you perform some action.  This is why &#8216;tail&#8217; is so handy.
Simply use the command below to view the last 100 lines of a log file, and [...]]]></description>
			<content:encoded><![CDATA[<p>When troubleshooting a problem in Apache it is a pain to open the log file, find an error, close the log file, and then open it again after you perform some action.  This is why &#8216;tail&#8217; is so handy.</p>
<p>Simply use the command below to view the last 100 lines of a log file, and as new entries are added to the file they are automatically displayed on the screen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>the<span style="color: #000000; font-weight: bold;">/</span>file<span style="color: #000000; font-weight: bold;">/</span>name <span style="color: #660033;">-n</span> <span style="color: #660033;">-100</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=46</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plesk backup problem</title>
		<link>http://www.geekyboy.com/?p=45</link>
		<comments>http://www.geekyboy.com/?p=45#comments</comments>
		<pubDate>Tue, 27 Nov 2007 15:23:18 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Disaster Recovery]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/archives/45</guid>
		<description><![CDATA[I had a problem backing up domains on a server and received the following error message:
Error: Unable to create backup session: Specified file is not accessible
Finally i solved this problem!!!! it was all about wrong permission in some folders!
check that the folders &#8216;/var/lib/psa/dumps&#8217; and &#8216;/var/lib/psa/dumps/tmp&#8217; are chmod to 777
]]></description>
			<content:encoded><![CDATA[<p>I had a problem backing up domains on a server and received the following error message:</p>
<p>Error: Unable to create backup session: Specified file is not accessible</p>
<p>Finally i solved this problem!!!! it was all about wrong permission in some folders!</p>
<p>check that the folders &#8216;/var/lib/psa/dumps&#8217; and &#8216;/var/lib/psa/dumps/tmp&#8217; are chmod to 777</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/?feed=rss2&amp;p=45</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
