<?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>My Galagzee!</title>
	<atom:link href="http://my.galagzee.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://my.galagzee.com</link>
	<description>Tech in a Galagzee, Not So Far Away.</description>
	<lastBuildDate>Sat, 06 Mar 2010 01:42:30 +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>Adding graphics, comments to PDFs</title>
		<link>http://my.galagzee.com/2010/03/05/adding-graphics-comments-to-pdfs/</link>
		<comments>http://my.galagzee.com/2010/03/05/adding-graphics-comments-to-pdfs/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 01:40:50 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Workflow]]></category>
		<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[flatten]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[stamp]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=398</guid>
		<description><![CDATA[I needed to fill out a PDF document today, date it, and sign it. It took me a good hour to accomplish the task as while the latest incarnation of Acrobat has custom stamp feature, annotated text doesn&#8217;t print by default (I also wanted to avoid having to print out the document only to scan [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to fill out a PDF document today, date it, and sign it. It took me a good hour to accomplish the task as while the latest incarnation of Acrobat has custom stamp feature, annotated text doesn&#8217;t print by default (I also wanted to avoid having to print out the document only to scan it back in). In fact, I found <em>no</em> way to print text annotations. Whether &#8220;Documents and Stamps&#8221; was selected in the Print properties or not, the text annotations would remain missing from the printout. It should not be this difficult to add a text box to a PDF document and then flatten it to be part of the document, and not an annotation per se.</p>
<p>After some more Googling later I happened on <a href="http://www.aecbytes.com/tipsandtricks/2006/issue2-acrobat.html">this</a> page that outlines a simple way to add &#8220;flatten&#8221; options to the Acrobat document menu. The associated script to be placed in “<strong>Program Files/Adobe/Acrobat 9.0/Acrobat/Javascripts/</strong>” folder (the script works with older Acrobat versions, too, as the mentioned instructions are for Acrobat 7.0) is just two lines long:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow"><ol><li></li><li>app.addMenuItem<span class="br0">&#40;</span><span class="br0">&#123;</span> cName: &quot;Flatten page&quot;, cParent: &quot;Document&quot;, cExec: &quot;flattenPages<span class="br0">&#40;</span>this.pageNum<span class="br0">&#41;</span>&quot;,cEnable: 1, nPos: 16<span class="br0">&#125;</span><span class="br0">&#41;</span>;</li><li>app.addMenuItem<span class="br0">&#40;</span><span class="br0">&#123;</span> cName: &quot;Flatten document&quot;, cParent: &quot;Document&quot;, cExec: &quot;flattenPages<span class="br0">&#40;</span><span class="br0">&#41;</span>&quot;,cEnable: 1, nPos: 17<span class="br0">&#125;</span><span class="br0">&#41;</span>;</li><li></li></ol></div></pre><!--END_DEVFMTCODE--><br />
With the above script installed, the task was a snap: I added my signature from a transparent PNG as a custom stamp, added the text annotations, and then flattened the document. Done! Now the annotations print out as they should (whether or not &#8220;Documents and Stamps&#8221; is selected in the Print properties as now the annotations are part of the &#8216;base&#8217; document). I can&#8217;t imagine why Adobe doesn&#8217;t include &#8220;flatten&#8221; as a default feature!</p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2010/03/05/adding-graphics-comments-to-pdfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ternary beauty</title>
		<link>http://my.galagzee.com/2010/02/08/ternary-beauty/</link>
		<comments>http://my.galagzee.com/2010/02/08/ternary-beauty/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 23:06:33 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ternary]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=391</guid>
		<description><![CDATA[I love the ternary operator. It can often simplify a much more complex conditional into few characters.  In PHP (and other c-like languages) it&#8217;s possible to all sorts of things with the ternary. The following are examples from PHP.
If $b is true, print &#8220;true&#8221;, otherwise print &#8220;false&#8221;. Echo doesn&#8217;t work here.
$b ? print &#34;true&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>I love the ternary operator. It can often simplify a much more complex conditional into few characters.  In PHP (and other c-like languages) it&#8217;s possible to all sorts of things with the ternary. The following are examples from PHP.</p>
<p>If $b is true, print &#8220;true&#8221;, otherwise print &#8220;false&#8221;. Echo doesn&#8217;t work here.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow"><ol><li></li><li>$b ? print &quot;true&quot; : print &quot;false&quot;;</li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Here&#8217;s something I learned today: it&#8217;s possible to assign a complex variable to an &#8220;internal&#8221; shorthand, and then in turn use the shorthand for the final assignment (based on the comparison). This way it&#8217;s not necessary to repeat the complex variable in the assignment section which makes the ternary much shorter and thus cleaner.</p>
<p>So instead of this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow"><ol><li></li><li>$a = <span class="br0">&#40;</span>$myObject-&gt;anotherObject-&gt;arr<span class="br0">&#91;</span>'somekey'<span class="br0">&#93;</span> &gt; 7 ? 7 : $myObject-&gt;anotherObject-&gt;arr<span class="br0">&#91;</span>'somekey'<span class="br0">&#93;</span><span class="br0">&#41;</span>;</li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>You can do this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow"><ol><li></li><li>$a = <span class="br0">&#40;</span><span class="br0">&#40;</span>$b = $myObject-&gt;arr<span class="br0">&#91;</span>'somekey'<span class="br0">&#93;</span><span class="br0">&#41;</span> &gt; 7 ? 7 : $b<span class="br0">&#41;</span>;</li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Awesome!! <img src='http://my.galagzee.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2010/02/08/ternary-beauty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Destroy Brand Confidence In One Hit</title>
		<link>http://my.galagzee.com/2010/01/20/how-to-destroy-brand-confidence-in-one-hit/</link>
		<comments>http://my.galagzee.com/2010/01/20/how-to-destroy-brand-confidence-in-one-hit/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 02:46:02 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[ocz]]></category>
		<category><![CDATA[power supply]]></category>
		<category><![CDATA[psu]]></category>
		<category><![CDATA[warranty]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=384</guid>
		<description><![CDATA[Couple of a weeks ago the power supply of one of our PCs failed. The system is about one and half years old, so fine – sometimes things break. I replaced the power supply and the system was back up and running. The failed OCZ power supply was under warranty, and so I sent it [...]]]></description>
			<content:encoded><![CDATA[<p>Couple of a weeks ago the power supply of one of our PCs failed. The system is about one and half years old, so fine – sometimes things break. I replaced the power supply and the system was back up and running. The failed OCZ power supply was under warranty, and so I sent it in for replacement. The usual way: I pay the shipping in, they pay the shipping back.</p>
<p>The replacement – a reconditioned unit – arrived yesterday. First thing I noticed that the &#8220;WARRANTY VOID IF BROKEN OR REMOVED&#8221; sticker was, well, broken. Hm. So today I went ahead and installed it back into the original system, taking out the temporary PSU. I really hate replacing power supplies when the case is even slightly congested and this one was pretty tough to get to. Finally, the replacement PSU was in place and I hit the power button. Nothing!</p>
<p>Few moments of testing later I had determined that the unit OCZ sent as a replacement was DOA. I had to rip it out and put the temp PSU back in. Note to self: from now on the PSU replacement protocol will include stand-alone testing the new unit before I touch the target system.</p>
<p>I very much doubt the unit broke in transit; I&#8217;m guessing they either didn&#8217;t test it after repairs were completed, or for some reason the unit was never serviced and so I got someone else&#8217;s failed PSU in exchange to PSU I sent in for warranty service. The only way OCZ can salvage the situation at this point and avoid getting on my bad list is if they offer to pay shipping both ways. It&#8217;s not that much money, but the time wasted on this far exceeded what the replacement is worth.</p>
<p>Many companies forget that the value of warranty they offer not only comes from what they can advertise but also from the PR – positive or negative – depending how they handle warranty.</p>
<p><strong>UPDATE 21 January 2010: Five Star Damage Control</strong></p>
<p>OCZ handled the situation about the only way they could&#8217;ve handled it to minimize the negative impression that had already been created: they offered a free upgrade to a new product, or a pre-paid shipping label to return the DOA unit to service/exchange  (apparently in case I <em>had</em> to keep the same model, such as a component for a tightly specified system). I chose the upgrade. Let&#8217;s hope the new unit works! <img src='http://my.galagzee.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>UPDATE 22 January 2010: Not so fast, my friend</strong></p>
<p>More to come. Dealing with OCZ tech support turned out to be less than what the first impression promised.</p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2010/01/20/how-to-destroy-brand-confidence-in-one-hit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling reCAPTCHA extra function buttons from tab index using jQuery</title>
		<link>http://my.galagzee.com/2009/09/30/disabling-recaptcha-function-keys-tabindex-jquery/</link>
		<comments>http://my.galagzee.com/2009/09/30/disabling-recaptcha-function-keys-tabindex-jquery/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 04:13:09 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=378</guid>
		<description><![CDATA[Here&#8217;s an easy way to disable the &#8220;Get a new challenge&#8221;, &#8220;Audio Challenge&#8221;, and &#8220;Help&#8221; buttons from reCAPTCHA display block using jQuery.
Simply add the following to $(document).ready(function() { &#8230; } on the page you have reCAPTCHA on:
$&#40;document&#41;.ready&#40;function&#40;&#41; &#123;&#160;&#160; $&#40;&#34;#recaptcha_reload_btn, #recaptcha_switch_audio_btn, #recaptcha_whatsthis_btn&#34;&#41;.attr&#40;&#34;tabindex&#34;, -1&#41;;&#125;&#41;; 

Now when you tab out of the word entry field, the extra function [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an easy way to disable the &#8220;Get a new challenge&#8221;, &#8220;Audio Challenge&#8221;, and &#8220;Help&#8221; buttons from <a href="http://recaptcha.net/" target="_blank">reCAPTCHA</a> display block using jQuery.</p>
<p>Simply add the following to <strong>$(document).ready(function() { &#8230; }</strong> on the page you have reCAPTCHA on:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow"><ol><li></li><li>$<span class="br0">&#40;</span>document<span class="br0">&#41;</span>.ready<span class="br0">&#40;</span>function<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></li><li>&nbsp;&nbsp; $<span class="br0">&#40;</span>&quot;#recaptcha_reload_btn, #recaptcha_switch_audio_btn, #recaptcha_whatsthis_btn&quot;<span class="br0">&#41;</span>.attr<span class="br0">&#40;</span>&quot;tabindex&quot;, -1<span class="br0">&#41;</span>;</li><li><span class="br0">&#125;</span><span class="br0">&#41;</span>; </li><li></li></ol></div></pre><!--END_DEVFMTCODE--><br />
<br />
Now when you tab out of the word entry field, the extra function buttons are skipped. This is a usability issue because if the extra buttons are left active in tab index, user can easily accidentally reload the challenge image when she thinks she is moving to the next item on the form (which is often the &#8220;submit&#8221; button), and then quickly hits Enter.</p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2009/09/30/disabling-recaptcha-function-keys-tabindex-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Explorations in the World of Linux</title>
		<link>http://my.galagzee.com/2009/09/05/explorations-in-the-world-of-linux/</link>
		<comments>http://my.galagzee.com/2009/09/05/explorations-in-the-world-of-linux/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 03:55:02 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[bsd]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=375</guid>
		<description><![CDATA[I&#8217;ve been a FreeBSD admin for the past decade, and during this time have become quite familiar with the *BSD system. It has its quirks, but overall it&#8217;s very clean and easy to maintain. 
From time to time – usually when I&#8217;ve been getting ready to upgrade to the next major revision of FreeBSD – [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a FreeBSD admin for the past decade, and during this time have become quite familiar with the *BSD system. It has its quirks, but overall it&#8217;s very clean and easy to maintain. </p>
<p>From time to time – usually when I&#8217;ve been getting ready to upgrade to the next major revision of FreeBSD – I&#8217;ve taken some time to research what the current pros and cons are for FreeBSD vs. some Linux distro. Always, in the end, FreeBSD has won.  However, a development project I&#8217;m starting to work on will utilize <a href="http://www.zend.com/en/products/server/" target="_blank">Zend Server</a>, which is only supported on handful of common Linux distros and on Windows (which is, by default, not an option as I strongly maintain that Windows is not suitable as a web server platform). There is, of course, Linux compatibility layer in FreeBSD, but as Zend doesn&#8217;t currently support it as a platform for Zend Server, I wouldn&#8217;t feel comfortable using it in a production environment.</p>
<p>So even though I find FreeBSD superior to Linux in many ways, I&#8217;ve now spent some time getting acquainted with Linux. I first started with Red Hat, then moved to CentOS which is the Linux distribution I&#8217;m currently testing. Now it&#8217;s not <em>bad</em>, per se, but I frequently come back to the thought: &#8220;Why would someone, anyone prefer THIS over a BSD system?!&#8221;  The package management with yum, rpm, and the GUI overlays is easy enough, but <em>it&#8217;s chaotic!</em> Having to enable and disable repos, set their priorities, etc. seems unnecessarily complicated. On the FreeBSD side there is the <a href="http://en.wikipedia.org/wiki/Ports_collection" target="_blank">ports collection</a> which provides most of the software that one can imagine ever needing.  The odd few items that either aren&#8217;t available in ports, or whose configuration is somehow not complete enough through ports can be easily compiled from the source tarball. Everything&#8217;s quite easy to keep track of, and to duplicate if one&#8217;s building a new system.</p>
<p>I&#8217;m sure some of this feeling stems from the fact that I have been using a BSD system for so long, and from the fact that I probably don&#8217;t yet know Linux well enough (say, to build the system from a scratch..). But as far as I can tell, package management <em>is</em> done with yum and rpm (on CentOS, say), by adjusting repository priorities, and enabling/disabling repositories. That is messy!</p>
<p>Well, I now have a functional development server running Zend Server with Apache, Subversion, and MySQL, and as the vendor (Zend) dictates the rules, I must continue development on Linux. Perhaps in six months time I&#8217;ll have more favorable comments about it as compared to FreeBSD&#8230; but I sort of doubt it.  My guess is I&#8217;ll just learn to live with it, every now and then wistfully glancing to the direction of the BSD server.</p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2009/09/05/explorations-in-the-world-of-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Something I didn&#8217;t know about KVM switches and Motherboard BIOS&#8230;</title>
		<link>http://my.galagzee.com/2009/09/02/something-i-didnt-know-about-kvm-switches-and-motherboard-bios/</link>
		<comments>http://my.galagzee.com/2009/09/02/something-i-didnt-know-about-kvm-switches-and-motherboard-bios/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 19:31:06 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[bios]]></category>
		<category><![CDATA[gigabyte]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[motherboard]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=366</guid>
		<description><![CDATA[I recently installed Gigabyte GA-EP45T-UD3LR motherboard to a small LAN file server. It&#8217;s a decent, stable, inexpensive board. But what I didn&#8217;t realize is that if you want to use a shared USB keyboard and mouse with a Windows system, some BIOS options must be available and editable (assuming they&#8217;re not set &#8220;correctly&#8221; by default [...]]]></description>
			<content:encoded><![CDATA[<p>I recently installed <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16813128371&#038;Tpk=gigabyte%20ga-ep45t-ud3lr">Gigabyte GA-EP45T-UD3LR</a> motherboard to a small LAN file server. It&#8217;s a decent, stable, inexpensive board. But what I didn&#8217;t realize is that if you want to use a shared USB keyboard and mouse with a Windows system, some BIOS options must be available and editable (assuming they&#8217;re not set &#8220;correctly&#8221; by default from the <abbr title="Keyboard, Video, Mouse">KVM</abbr> switch&#8217;s point of view). This motherboard&#8217;s BIOS doesn&#8217;t have those options and apparently the BIOS defaults aren&#8217;t the right ones for this kind of use. The result: once USB keyboard and mouse have been switched away from the system with a KVM switch, they&#8217;ll never be reacquired by the system until the system is rebooted. Fortunately <abbr title="Remote Desktop Connection">RDC</abbr> works so that the console is not usually—or at least is very rarely—needed&#8230;</p>
<p>For reference, if you&#8217;re planning to use a Windows system with a KVM switch, make sure its BIOS has the following options:</p>
<ul>
<li>HALT ON ERROR: All but keyboard (usually in Standard CMOS settings)</li>
<li>PnP OS: yes (usually in PnP/PCI settings)</li>
<li>USB IRQ: enabled (usually in PnP/PCI settings)</li>
</ul>
<p>Without these options set the only way to find out whether a specific motherboard will or will not work with a USB KVM switch, is to try. Gigabyte GA-EP45T-UD3LR does not.</p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2009/09/02/something-i-didnt-know-about-kvm-switches-and-motherboard-bios/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Unix Commands Galore</title>
		<link>http://my.galagzee.com/2009/08/04/unix-commands-galore/</link>
		<comments>http://my.galagzee.com/2009/08/04/unix-commands-galore/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 04:48:26 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=336</guid>
		<description><![CDATA[Couple of days ago a friend of mine pointed me to commandlinefu.com.  It&#8217;s strange how addictive a service like that can be! I&#8217;ve perused a good chunk of the commands posted on the site, learned quite a few new things, augmented the command aliases on my servers, and posted few of my brainchildren as [...]]]></description>
			<content:encoded><![CDATA[<p>Couple of days ago a friend of mine pointed me to <a href="http://www.commandlinefu.com/" target="_blank">commandlinefu.com</a>.  It&#8217;s strange how addictive a service like that can be! I&#8217;ve perused a good chunk of the commands posted on the site, learned quite a few new things, augmented the command aliases on my servers, and <a href="http://www.commandlinefu.com/commands/by/vwal"  target="_blank">posted few of my brainchildren</a> as well as posted suggested fixes to some that I found to be a cool ideas but that didn&#8217;t work for me as they were presented (such as the <a href="http://www.commandlinefu.com/commands/view/887/copy-a-mysql-database-to-a-new-server-via-ssh-with-one-command"  target="_blank">command to copy database from a local MySQL server to a remote MySQL server over SSH</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2009/08/04/unix-commands-galore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting all network interface aliases</title>
		<link>http://my.galagzee.com/2009/07/22/deleting-all-network-interface-aliases/</link>
		<comments>http://my.galagzee.com/2009/07/22/deleting-all-network-interface-aliases/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 06:13:21 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[deleting IP aliases]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[netstart]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=313</guid>
		<description><![CDATA[I recently needed to move bunch of aliased IPs from one FreeBSD server to another. Adding aliases to /etc/rc.conf and then running ./netstart while in /etc adds new multiplexed IPs to the system all right, but if you need to remove aliased IPs, running /etc/netstart won&#8217;t remove them even if the aliases have been removed [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to move bunch of aliased IPs from one FreeBSD server to another. Adding aliases to /etc/rc.conf and then running ./netstart while in /etc <em>adds</em> new multiplexed IPs to the system all right, but if you need to remove aliased IPs, running /etc/netstart won&#8217;t remove them even if the aliases have been removed from /etc/rc.conf. Perhaps there is some easy single command that culls the active alias IPs to those specified in /etc/rc.conf, but I&#8217;m not aware of it.  The following command can be used to quickly delete all aliased IPs for a specific interface (here &#8220;em0&#8243;):</p>
<p><strong>ifconfig | grep &#8220;0xffffffff&#8221; | awk &#8216;{ print $2 }&#8217; | xargs -n 1 ifconfig em0 delete</strong></p>
<p>For this to work, the netmasks of the aliases and the master IP for the inteface must differ. The netmasks of the aliases are usually set to 255.255.255.255 (hence &#8220;0xffffffff&#8221;) while the netmask of the master IP is usually something different, specific to your network, e.g. 255.255.255.128 (&#8220;0xffffff80&#8243;).</p>
<p>Once the above command has been run, /etc/netstart can then be executed to load the remaining or reconfigured aliases (if any) from /etc/rc.conf.</p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2009/07/22/deleting-all-network-interface-aliases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBSD Full / Incremental Filesystem Dump Shell Script</title>
		<link>http://my.galagzee.com/2009/07/17/freebsd-dump-filesystem-shell-script/</link>
		<comments>http://my.galagzee.com/2009/07/17/freebsd-dump-filesystem-shell-script/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 05:19:25 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[automatic]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[incremental]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=232</guid>
		<description><![CDATA[A FreeBSD shell script to dump filesystems with full, and automatically incremented incremental backups to a given directory location.]]></description>
			<content:encoded><![CDATA[<p>I wanted to automate filesystem dumps on my servers running FreeBSD 7.2.  After some searching I came across Vivek Gite&#8217;s <a href="http://bash.cyberciti.biz/backup/freebsd-dump-filesystem-shell-script/" target="_blank">FreeBSD Full / Incremental <strong>Tape</strong> Backup Shell Script</a> which gave me a lot of ideas.  Since I&#8217;m not using tape as the backup target I wanted to make a script specifically for that purpose while at the same time improve handling of some error conditions (such as, most importantly, checking for a missing level 0 dump before proceeding with an incremental dump) and add some new features such as autoincrement the dump level so that the dump level is not tied to specific day of the week.</p>
<p>Here&#8217;s my version of the script.  While it bears some resemblance to Vivek&#8217;s script, it is largely rewritten.  Read the script header for more information.</p>
<p><strong>NOTE!</strong> In his <a href="http://my.galagzee.com/2009/07/17/freebsd-dump-filesystem-shell-script/#comment-9988">comment</a> <em>James</em> pointed out a possible bug in the script.  The displayed script indeed had a problem: it was missing a backslash in front of the first dollar sign at:</p>
<p>eval &#8220;local fspath=<strong>\</strong>$${fsname}path&#8221;</p>
<p>This was caused by the script display plugin in WordPress that treated the backslash as an escape character (<a href="http://wordpress.org/support/topic/256742?replies=12#post-1168286" target="_blank">this has now been fixed</a>). To be on the safe side, please <strong><a href="http://my.galagzee.com/wp-content/uploads/2009/08/autodump-1.5a.tar">download the script as a tarball</a>.</strong> To further validate the integrity of the tarball, it should produce a md5 hash of 732ac44f11ba4484be4568e84929bb6a. </p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title=""><div class="devcodeoverflow"><ol><li></li><li>#!/bin/sh</li><li>&nbsp;</li><li># Autodump 1.5a <span class="br0">&#40;</span>released 01 August 2009<span class="br0">&#41;</span></li><li># Copyright <span class="br0">&#40;</span>c<span class="br0">&#41;</span> 2009 Ville Walveranta </li><li>#</li><li># A FreeBSD shell script to dump filesystems with full, and automatically </li><li># incremented incremental backups to a given directory location; this script</li><li># was written with the intent of saving the filesystem dumps not onto a tape</li><li># device but on another hard drive such as a different filesystem on the same </li><li># computer. The resulting dump files can be copied offsite with a separate </li><li># cron job.</li><li>#</li><li># This script creates the necessary directory structure below the defined </li><li># 'BASEDIR' as well as the necessary log file. This script also ensures that</li><li># the level 0 dump exists before creating an incremental dump; if it doesn't</li><li># the script automatically erases the incremental files for the current week </li><li># <span class="br0">&#40;</span>if any exist<span class="br0">&#41;</span> and starts over with a level 0 dump. This way you can start </li><li># using the script on any day of the week and level 0 dump is automatically </li><li># created on the first run.</li><li>#</li><li># When ran daily <span class="br0">&#40;</span>such as from a cron job<span class="br0">&#41;</span>, the script creates level 0 dump</li><li># on every Monday <span class="br0">&#40;</span>beginning the ISO week<span class="br0">&#41;</span>, or Sunday <span class="br0">&#40;</span>beginning of the U.S. </li><li># week<span class="br0">&#41;</span> and an incremental dump on all the other days of each week. The dumps </li><li># are compressed with gzip and saved below the 'BASEDIR' to an automatically </li><li># created directory whose name is derived from the list given in 'FSNAMES'. </li><li># Each week's dumps are organized into subfolders with name YYYY-WW <span class="br0">&#40;</span>'WW' </li><li># being the current week<span class="br0">&#41;</span>. By default three most recent weekly dumps </li><li># <span class="br0">&#40;</span>level 0 + incrementals<span class="br0">&#41;</span> are retained.</li><li>#</li><li># The script maintains each weekly folder's date at the _beginning_ date</li><li># of the dump <span class="br0">&#40;</span>i.e. Monday or Sunday of the current week<span class="br0">&#41;</span> at 00:00, not </li><li># at the most recent incremental's date/time.</li><li>#</li><li># By default the root <span class="br0">&#40;</span>/<span class="br0">&#41;</span> and usr <span class="br0">&#40;</span>/usr<span class="br0">&#41;</span> filesystems are dumped. To add more&nbsp;&nbsp;</li><li># add a &quot;friendly name&quot; to the 'FSNAMES' list <span class="br0">&#40;</span>it is used for the weekly folder</li><li># names, for dump filenames, and to reference the corresponding mount point</li><li># variable<span class="br0">&#41;</span>; then add the corresponding mount point variable <span class="br0">&#40;</span>i.e. if you </li><li># add &quot;var&quot; to 'FSNAMES', then add a variable varpath=/var<span class="br0">&#41;</span>. The &quot;path&quot; </li><li># ending of the mount point variable name is required. </li><li>#</li><li># Since the number of incremental dumps is limited to nine <span class="br0">&#40;</span>level 0 +</li><li># incremental levels 1-9<span class="br0">&#41;</span>, the script will allow maximum of one dump </li><li># to be created per day. However, since the level incrementing is dynamic</li><li># you can start the script on any day of the week, and run it on any</li><li># number of days during the rest of the week and you'll always get</li><li># level 0 plus the incremental dumps in sequential order. However, The </li><li># new weekly folder is always created on Monday or Sunday <span class="br0">&#40;</span>as chosen by</li><li># you<span class="br0">&#41;</span>. Note that the script determines whether &quot;today's&quot; dump exists </li><li># based on the modification date stamp of the most recent dump. Hence </li><li># it is a good idea to run this script in the early hours of each day </li><li># rather than in the very end of each day. Running the script, for </li><li># example, at 23:50 has the potential to push longer dump processes </li><li># over the midnight and so potentially cause the next day's dump to </li><li># be skipped.</li><li>#</li><li># Written for FreeBSD 7.2 but should work on most BSD and *NIX systems with</li><li># minor modifications.</li><li># -------------------------------------------------------------------------</li><li># Copyright <span class="br0">&#40;</span>c<span class="br0">&#41;</span> 2009 Ville Walveranta </li><li># &lt;http://my.galagzee.com/2009/07/17/freebsd-dump-filesystem-shell-script&gt;</li><li># This script is licensed under GNU GPL version 2.0 or above, and is provided</li><li># 'as-is' with no warranty which is to say that I'm not liable if it wipes out</li><li># your hard drive clean or doesn't back up your precious data. However, to the </li><li># best or my knowledge it is working as expected -- I'm using it myself. :-<span class="br0">&#41;</span></li><li># -------------------------------------------------------------------------</li><li># This script was inspired by </li><li># FreeBSD Full / Incremental Tape Backup Shell Script</li><li># by nixCraft project / Vivek Gite</li><li># at &lt;http://bash.cyberciti.biz/backup/freebsd-dump-filesystem-shell-script/&gt;</li><li># -------------------------------------------------------------------------</li><li>&nbsp;</li><li>&nbsp;</li><li>#### GLOBAL VARIABLES ###############################################</li><li>&nbsp;</li><li>WEEKSTARTS=Mon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Accepted values are &quot;Mon&quot; <span class="br0">&#40;</span>ISO standard<span class="br0">&#41;</span> or &quot;Sun&quot; <span class="br0">&#40;</span>U.S.<span class="br0">&#41;</span></li><li>KEEPDUMPS=30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# in days; this is evaluated on the weekly level per start</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# of the week, so '30' keeps 3-4 weekly dumps</li><li>BASEDIR=/bak/dumps</li><li>GLOBALDUMPOPTS=Lua&nbsp;&nbsp;# add 'n' for wall notifications</li><li>LOGFILE=/var/log/dump.log</li><li>&nbsp;</li><li># to add more filesystems to be dumped add the dump name in 'FSNAMES'</li><li># and add the corresponding mount point variable <span class="br0">&#40;</span>dumpname+path=mountpoint<span class="br0">&#41;</span></li><li>FSNAMES=&quot;root usr&quot;&nbsp;&nbsp;# this is used for dump directory name </li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# and to ID the path from a variable below</li><li>rootpath=/</li><li>usrpath=/usr</li><li>&nbsp;</li><li>#####################################################################</li><li>&nbsp;</li><li>DUMP=/sbin/dump</li><li>GZIP=/usr/bin/gzip</li><li>LOGGER=/usr/bin/logger</li><li>&nbsp;</li><li>WEEKDAY=$<span class="br0">&#40;</span>date +&quot;%a&quot;<span class="br0">&#41;</span></li><li>DATE=$<span class="br0">&#40;</span>date +&quot;%Y%m%d&quot;<span class="br0">&#41;</span></li><li>HUMANDATE=$<span class="br0">&#40;</span>date +&quot;%d-%b-%Y&quot;<span class="br0">&#41;</span></li><li>HUMANDATE=`echo $HUMANDATE | tr '<span class="br0">&#91;</span>:lower:<span class="br0">&#93;</span>' '<span class="br0">&#91;</span>:upper:<span class="br0">&#93;</span>'`</li><li>HUMANTIME=$<span class="br0">&#40;</span>date +&quot;%H:%M <span class="br0">&#40;</span>%Z<span class="br0">&#41;</span>&quot;<span class="br0">&#41;</span></li><li>TODAYYR=$<span class="br0">&#40;</span>date +&quot;%Y&quot;<span class="br0">&#41;</span></li><li>TODAYMO=$<span class="br0">&#40;</span>date +&quot;%m&quot;<span class="br0">&#41;</span></li><li>TODAYDT=$<span class="br0">&#40;</span>date +&quot;%d&quot;<span class="br0">&#41;</span></li><li>&nbsp;</li><li># datestamp at midnight today</li><li>TODAYSTARTSTAMP=$<span class="br0">&#40;</span>date -j +%s &quot;$<span class="br0">&#123;</span>TODAYYR<span class="br0">&#125;</span>$<span class="br0">&#123;</span>TODAYMO<span class="br0">&#125;</span>$<span class="br0">&#123;</span>TODAYDT<span class="br0">&#125;</span>0000&quot;<span class="br0">&#41;</span></li><li>&nbsp;</li><li># default lastdump to midnight today; it will be checked</li><li># and and adjusted later</li><li>LASTDUMP=$TODAYSTARTSTAMP</li><li>&nbsp;</li><li># do not crete world-readable dumps!</li><li>umask 117</li><li>&nbsp;</li><li># make sure the logfile exists</li><li>if <span class="br0">&#91;</span> ! -e $LOGFILE <span class="br0">&#93;</span> ; then</li><li>&nbsp;&nbsp; touch $LOGFILE</li><li>&nbsp;&nbsp; chmod 660 $LOGFILE</li><li>fi</li><li>&nbsp;</li><li># make sure that entire week's incremental dumps are deposted</li><li># in the same directory, even when a week spans new year</li><li># NOTE: When the ending year has a partial 53rd week, there</li><li># won't be a dump folder for the first week of the new year.</li><li># The incremental dumps instead complete the 53rd week folder,</li><li># even when the 1st week of the new year begins mid-week. </li><li># However, the dates of the incremental dump files in the </li><li># 53rd week folder correctly reflect the dates of the </li><li># beginning year.</li><li>adjust_date<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></li><li>&nbsp;&nbsp; local dateoffset=$1</li><li>&nbsp;&nbsp; local epochnow=$<span class="br0">&#40;</span>date +%s<span class="br0">&#41;</span></li><li>&nbsp;&nbsp; local offsetsecs=`expr $dateoffset &quot;*&quot; 86400`</li><li>&nbsp;&nbsp; local newepoch=`expr $epochnow &quot;-&quot; $offsetsecs`</li><li>&nbsp;&nbsp; local year=`date -r $newepoch +&quot;%Y&quot;`</li><li>&nbsp;</li><li>&nbsp;&nbsp; if <span class="br0">&#91;</span> &quot;$WEEKSTARTS&quot; = &quot;Mon&quot; <span class="br0">&#93;</span> ; then</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local week=`date -r $newepoch +&quot;%W&quot;`</li><li>&nbsp;&nbsp; else</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local week=`date -r $newepoch +&quot;%U&quot;`</li><li>&nbsp;&nbsp; fi</li><li>&nbsp;&nbsp; NEWEPOCHISO=`date -r $newepoch +&quot;%Y%m%d0000&quot;`</li><li>&nbsp;</li><li>&nbsp;&nbsp; #system week starts from `0', there is no calendar week `0'</li><li>&nbsp;&nbsp; week=`expr $week &quot;+&quot; 1`</li><li>&nbsp;&nbsp; YWEEK=$<span class="br0">&#123;</span>year<span class="br0">&#125;</span>-$<span class="br0">&#123;</span>week<span class="br0">&#125;</span></li><li><span class="br0">&#125;</span></li><li>&nbsp;</li><li># determines the 'distance' from the level 0 dump in days</li><li>if <span class="br0">&#91;</span> &quot;$WEEKSTARTS&quot; = &quot;Mon&quot; <span class="br0">&#93;</span> ; then</li><li>&nbsp;&nbsp; case $WEEKDAY in</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mon<span class="br0">&#41;</span> adjust_date <span style="">0</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tue<span class="br0">&#41;</span> adjust_date <span style="">1</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wed<span class="br0">&#41;</span> adjust_date <span style="">2</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thu<span class="br0">&#41;</span> adjust_date <span style="">3</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fri<span class="br0">&#41;</span> adjust_date <span style="">4</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sat<span class="br0">&#41;</span> adjust_date <span style="">5</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sun<span class="br0">&#41;</span> adjust_date <span style="">6</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<span class="br0">&#41;</span> ;;</li><li>&nbsp;&nbsp; esac</li><li>else </li><li>&nbsp;&nbsp; case $WEEKDAY in</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sun<span class="br0">&#41;</span> adjust_date <span style="">0</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mon<span class="br0">&#41;</span> adjust_date <span style="">1</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tue<span class="br0">&#41;</span> adjust_date <span style="">2</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wed<span class="br0">&#41;</span> adjust_date <span style="">3</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thu<span class="br0">&#41;</span> adjust_date <span style="">4</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fri<span class="br0">&#41;</span> adjust_date <span style="">5</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sat<span class="br0">&#41;</span> adjust_date <span style="">6</span>;;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<span class="br0">&#41;</span> ;;</li><li>&nbsp;&nbsp; esac</li><li>fi</li><li>&nbsp;</li><li>mk_auto_dump<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp; local fsname=$1</li><li>&nbsp;</li><li>&nbsp;&nbsp; # get the current filesystem's path</li><li>&nbsp;&nbsp; # as defined in the corresponding variable</li><li>&nbsp;&nbsp; eval &quot;local fspath=\$$<span class="br0">&#123;</span>fsname<span class="br0">&#125;</span>path&quot;</li><li>&nbsp;</li><li>&nbsp;&nbsp; # composite the dump path</li><li>&nbsp;&nbsp; local dumppath=$<span class="br0">&#123;</span>BASEDIR<span class="br0">&#125;</span>/$<span class="br0">&#123;</span>fsname<span class="br0">&#125;</span>/$<span class="br0">&#123;</span>YWEEK<span class="br0">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp; # make sure the dump directory for this week exists;</li><li>&nbsp;&nbsp; # this automatically creates a new dump directory on </li><li>&nbsp;&nbsp; # every Monday or Sunday <span class="br0">&#40;</span>as selected by 'WEEKSTARTS'<span class="br0">&#41;</span></li><li>&nbsp;&nbsp; <span class="br0">&#91;</span> ! -d $dumppath <span class="br0">&#93;</span> &amp;&amp; mkdir -p $dumppath</li><li>&nbsp;</li><li>&nbsp;&nbsp; # get name of the last file in the current dump directory</li><li>&nbsp;&nbsp; local lastfile=`ls -ltr $dumppath | grep -v &quot;^d&quot; | tail -n 1 | awk '<span class="br0">&#123;</span> print $9 <span class="br0">&#125;</span>'`</li><li>&nbsp;</li><li>&nbsp;&nbsp; # assume that the 'lastfile', if it exists, was not created today</li><li>&nbsp;&nbsp; local dumped_today=false</li><li>&nbsp;</li><li>&nbsp;&nbsp; # if a file exists, check its modification date; </li><li>&nbsp;&nbsp; # if it is at or after 00:00 today, set a flag to skip the dump</li><li>&nbsp;&nbsp; if <span class="br0">&#91;</span> &quot;$lastfile&quot; != &quot;&quot; <span class="br0">&#93;</span> ; then</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local fq_lastfile=$<span class="br0">&#123;</span>dumppath<span class="br0">&#125;</span>/$lastfile</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if <span class="br0">&#91;</span> -e $fq_lastfile <span class="br0">&#93;</span> ; then</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # get the last modification time for the most recently created dumpfile</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LASTDUMP=`stat -f %m $fq_lastfile`</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if <span class="br0">&#91;</span> $LASTDUMP -ge $TODAYSTARTSTAMP <span class="br0">&#93;</span> ; then</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local dumped_today=true</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi</li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# get the first and the last dump level for this directory</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local levelcommand=&quot;ls $dumppath | sed -e 's/^<span class="br0">&#91;</span><span class="br0">&#91;</span>:digit:<span class="br0">&#93;</span><span class="br0">&#93;</span>*\_//' | sed -e 's/\..*$//'&quot;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local firstlevel=`eval $levelcommand | head -n 1`</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local lastlevel=`eval $levelcommand | tail -n 1`</li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# make sure level zero dump exists;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# if it doesn't, start over</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if <span class="br0">&#91;</span> &quot;$firstlevel&quot; != &quot;0&quot; <span class="br0">&#93;</span> ; then</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # it doesn't matter if a previous dump exists from today</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # since we're starting over as level 0 dump is missing</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local dumped_today=false</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local dumplevel=0</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rm -f $dumppath/*.gz</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # otherwise just increment the dump level</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # for levels 1-6, i.e. normally Tuesday thru Sunday</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local dumplevel=`expr $lastlevel &quot;+&quot; 1`</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi</li><li>&nbsp;&nbsp; else</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# no dump exists in this week's folder; reset level to '0'</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local dumplevel=0</li><li>&nbsp;&nbsp; fi</li><li>&nbsp;</li><li>&nbsp;&nbsp; # skip the entire dump process if a dumpfile has</li><li>&nbsp;&nbsp; # already been created for this filesystem today</li><li>&nbsp;&nbsp; if <span class="br0">&#91;</span> &quot;$dumped_today&quot; = &quot;false&quot; <span class="br0">&#93;</span> ; then&nbsp;&nbsp;</li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# define the dump filename</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local dumpfn=$<span class="br0">&#123;</span>DATE<span class="br0">&#125;</span>_$<span class="br0">&#123;</span>dumplevel<span class="br0">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo ---------------- &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo BEGINNING LEVEL $dumplevel DUMP OF \'$fsname\' \<span class="br0">&#40;</span>$<span class="br0">&#123;</span>fspath<span class="br0">&#125;</span>\<span class="br0">&#41;</span> FILESYSTEM ON $HUMANDATE AT $HUMANTIME &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo Creating a snapshot of \'$fspath\'.. &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# execute the dump</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$DUMP -$dumplevel -$GLOBALDUMPOPTS -f $<span class="br0">&#123;</span>dumppath<span class="br0">&#125;</span>/$<span class="br0">&#123;</span>dumpfn<span class="br0">&#125;</span> $fspath &gt;&gt; $LOGFILE 2&gt;&amp;1</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local dumpresult=$?</li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if <span class="br0">&#91;</span> &quot;$dumpresult&quot; != &quot;0&quot; <span class="br0">&#93;</span> ; then</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # log the dump result to syslog</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $LOGGER &quot;$DUMP LEVEL $dumplevel DUMP OF $fsname <span class="br0">&#40;</span>$<span class="br0">&#123;</span>fspath<span class="br0">&#125;</span><span class="br0">&#41;</span> FAILED!&quot;</li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &quot;*** DUMP FAILED - LEVEL $dumplevel DUMP of $fsname <span class="br0">&#40;</span>$<span class="br0">&#123;</span>fspath<span class="br0">&#125;</span><span class="br0">&#41;</span> ***&quot; &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # log the dump result to syslog</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $LOGGER &quot;LEVEL $dumplevel DUMP of $fsname <span class="br0">&#40;</span>$<span class="br0">&#123;</span>fspath<span class="br0">&#125;</span><span class="br0">&#41;</span> COMPLETED SUCCESSFULLY!&quot;</li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # compress the dump</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo Compressing the dumpfile \'$<span class="br0">&#123;</span>dumpfn<span class="br0">&#125;</span>\'.. &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $GZIP -v $<span class="br0">&#123;</span>dumppath<span class="br0">&#125;</span>/$<span class="br0">&#123;</span>dumpfn<span class="br0">&#125;</span> &gt;&gt; $LOGFILE 2&gt;&amp;1</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo DONE &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &gt;&gt; $LOGFILE</li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # make sure dumps are not world readable <span class="br0">&#40;</span>security risk!<span class="br0">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo Updating dumpfile \'$<span class="br0">&#123;</span>dumpfn<span class="br0">&#125;</span>.gz\' permissions.. &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chmod -v -v 440 $<span class="br0">&#123;</span>dumppath<span class="br0">&#125;</span>/$<span class="br0">&#123;</span>dumpfn<span class="br0">&#125;</span>.gz &gt;&gt; $LOGFILE 2&gt;&amp;1</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo DONE &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &gt;&gt; $LOGFILE</li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # reset current dump dir's timestamp to that of the level 0 dump</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; touch -t $<span class="br0">&#123;</span>NEWEPOCHISO<span class="br0">&#125;</span> $<span class="br0">&#123;</span>dumppath<span class="br0">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # delete old dumps</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo Deleting old \'$fsname\' dumpfiles.. &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; find $BASEDIR/$fsname -mtime +$KEEPDUMPS -maxdepth 1 -print -exec rm -rf <span class="br0">&#123;</span><span class="br0">&#125;</span> \; &gt;&gt; $LOGFILE <span style="">2</span>&gt;&amp;<span style="">1</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo DONE &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &gt;&gt; $LOGFILE</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi</li><li>&nbsp;&nbsp; else</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local lastdump_readable=`date -j -r $LASTDUMP +&quot;%H:%M&quot;`</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local lastdump_readableZ=`date -j -r $LASTDUMP +&quot;%Z&quot;`</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local lastdumpmsg=&quot;Autodump for filesystem '$fsname' <span class="br0">&#40;</span>$fspath<span class="br0">&#41;</span> has already been executed today at $lastdump_readable <span class="br0">&#40;</span>$lastdump_readableZ<span class="br0">&#41;</span>.&quot;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $lastdumpmsg</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$LOGGER $lastdumpmsg</li><li>&nbsp;&nbsp; fi</li><li><span class="br0">&#125;</span></li><li>&nbsp;</li><li>&nbsp;</li><li># Dump filesystems defined in 'FSNAMES'</li><li>#</li><li># Monday or Sunday <span class="br0">&#40;</span>as selected by 'WEEKSTARTS'<span class="br0">&#41;</span> starts with </li><li># the level <span style="">0</span> dump, with incrementals created through the rest of </li><li># the week <span class="br0">&#40;</span>autoincremented<span class="br0">&#41;</span>. If the level <span style="">0</span> dump is missing in </li><li># the current week's folder for filesystem currently being backed </li><li># up, it is created automatically instead of an incremental dump, </li><li># no matter what day of the week it is.</li><li>for f in $FSNAMES</li><li>do</li><li>&nbsp;&nbsp; mk_auto_dump $f</li><li>done</li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2009/07/17/freebsd-dump-filesystem-shell-script/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>FreeBSD vs the world</title>
		<link>http://my.galagzee.com/2009/06/22/freebsd-vs-the-world/</link>
		<comments>http://my.galagzee.com/2009/06/22/freebsd-vs-the-world/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 00:59:58 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=225</guid>
		<description><![CDATA[As I upgraded few FreeBSD installations to FreeBSD 7.2 over the last couple of days, I took the customary stroll to see how FreeBSD continues to stack up against the Linux distributions.  And once again I determined it does so very well.  I&#8217;ve been a devout FreeBSD user for almost a decade, and every time [...]]]></description>
			<content:encoded><![CDATA[<p>As I upgraded few FreeBSD installations to FreeBSD 7.2 over the last couple of days, I took the customary stroll to see how FreeBSD continues to stack up against the Linux distributions.  And once again I determined it does so very well.  I&#8217;ve been a devout FreeBSD user for almost a decade, and every time I take a look at the Linux world I come back to the same conclusion: I like the fact that there is just one FreeBSD. It&#8217;s very well managed and its QA is excellent (not to mention its TCP stack is famed for being the most stable, and its ports collection rivals anything offered by Linux).</p>
<p>Here&#8217;re couple of useful sites for those wondering which OS to choose:</p>
<p><a href="http://polishlinux.org/choose/comparison/?distro1=FreeBSD&amp;distro2=Debian" target="_blank">Polishlinux.org &#8211; Compare distros: FreeBSD vs. Debian</a> &#8211; Comparison data is up to date and there are a lot of good user comments to sift through. You can also choose other distros to compare to.</p>
<p><a href="http://en.wikipedia.org/wiki/Comparison_of_BSD_operating_systems" target="_blank">Wikipedia &#8211; Comparison of BSD operating systems</a></p>
<p>And lastly, a good example of why the sheer number of Linux distros is disorienting: <a href="http://distrowatch.com/" target="_blank">DistroWatch</a> lists at least a few hundred Linux distros (plus couple of BSD derivatives).</p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2009/06/22/freebsd-vs-the-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
