<?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>Zulius &#187; freebies</title>
	<atom:link href="http://www.zulius.com/category/freebies/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zulius.com</link>
	<description>Advanced Application Development</description>
	<lastBuildDate>Mon, 30 Aug 2010 20:44:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>bash-beauty: formatted output for bash scripts</title>
		<link>http://www.zulius.com/freebies/bash-beauty-output-for-bash-scripts/</link>
		<comments>http://www.zulius.com/freebies/bash-beauty-output-for-bash-scripts/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 23:46:33 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[freebies]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=408</guid>
		<description><![CDATA[A bash function library for displaying beautiful script progress output.]]></description>
			<content:encoded><![CDATA[<div style="margin: 0 auto; text-align: center"><a title="Download" href="/scripts/bash-beauty.sh" target="_blank"><img src="/img/button-dl-orange.png" alt="" width="202" height="62" /></a></div>
<div style="float: right; padding: 0 5px; margin: 25px 0 0 0;width: 160px">
<div style="clear: both">
<div class="wp-caption alignright" style="width: 160px"><a id="ss1" href="/img/blog/bash-beauty/bash-beauty-ss1.jpg" rel="colorbox"><img title="bash-beauty screenshot #1" src="/img/blog/bash-beauty/bash-beauty-ss1-thumb.jpg" alt="bash-beauty screenshot #1" width="150" height="110" /></a><p class="wp-caption-text">screenshot #1</p></div><br />
<script type="text/javascript">jQuery(document).ready(function(){jQuery("#ss1").colorbox({title: 'basic usage'});});</script>
</div>
<div style="clear: both">
<div class="wp-caption alignright" style="width: 160px"><a id="ss2" href="/img/blog/bash-beauty/bash-beauty-ss2.jpg" rel="colorbox"><img title="bash-beauty screenshot #2" src="/img/blog/bash-beauty/bash-beauty-ss2-thumb.jpg" alt="bash-beauty screenshot #2" width="150" height="110" /></a><p class="wp-caption-text">screenshot #2</p></div><br />
<script type="text/javascript">jQuery(document).ready(function(){jQuery("#ss2").colorbox({title: 'Print multi-colored result statuses'});});</script><br />

</div>
<div style="clear: both">
<div class="wp-caption alignright" style="width: 160px"><a id="ss3" href="/img/blog/bash-beauty/bash-beauty-ss3.jpg" rel="colorbox"><img title="bash-beauty screenshot #3" src="/img/blog/bash-beauty/bash-beauty-ss3-thumb.jpg" alt="bash-beauty screenshot #3" width="150" height="110" /></a><p class="wp-caption-text">screenshot #3</p></div><br />
<script type="text/javascript">jQuery(document).ready(function(){jQuery("#ss3").colorbox({title: 'Prefix each task with a 14 digit timestamp'});});</script>
</div>
</div>
<h2>What is it?</h2>
<p>
Bash function library for displaying script progress output.  The functions imitate the display format of Linux boot messages.</p>
<h2>What does it do?</h2>
<ul>
<li>Logs/echo's script tasks and results in a columnar format</li>
<li>Appends each task line with a colored status result (terminal stdout only)</li>
<li>Makes your script's output look good and readable</li>
</ul>
<h2>Other Features</h2>
<ul>
<li>Customizable message column width</li>
<li>Quiet mode writes only to a specified log file</li>
<li>Optionally prefixes all messages with a 14 digit timestamp</li>
<li>Free</li>
</ul>
<h2>Requirements</h2>
<p style="padding-left: 30px;">
<a title="Perl" href="http://www.gnu.org/software/bash/" target="_blank">GNU Bourne-Again Shell (BASH)</a>
</p>
<h2>Functions</h2>
<p>The bash-beauty.sh library has 5 printing functions: </p>
<ul>
<li>
<h4 style="margin-top: 0">printTask</h4>
<pre>Prints a single task message padded with whitespace to default 80 characters.</pre>
<div>
<h4 class="usage" style="margin-top: 10px">Usage</h4>
<pre style="margin-bottom: 15px">
printTask [OPTION]... MESSAGE
</pre>
<h4 class="usage" style="margin-top: 10px">Options</h4>
<pre style="margin-bottom: 15px">
-t     flag to automatically prepend message with 14 digit timestamp
-l     specify log file to write to
-q     quiet mode. Do not output to stdout, only write to log file if supplied
-w     width of padded message column. Defaults to 80 characters.
</pre>
</div>
</li>
<li>
<h4 style="margin-top: 0">printOk</h4>
<pre>Prints a green OK status result <span style="font-family:  'Lucida Console', 'Courier New', Courier, monospace; color: green">[  OK  ]</span></pre>
<div>
<h4 class="usage" style="margin-top: 10px">Usage</h4>
<pre style="margin-bottom: 15px">
printOk [OPTION]...
</pre>
<h4 class="usage" style="margin-top: 10px">Options</h4>
<pre style="margin-bottom: 15px">
-l     specify log file to write to
-q     quiet mode. Do not output to stdout, only write to log file if supplied
</pre>
</div>
</li>
<li>
<h4 style="margin-top: 0">printFail</h4>
<pre>Prints a red failure status result <span style="font-family:  'Lucida Console', 'Courier New', Courier, monospace; color: red">[FAILED]</span></pre>
<div>
<h4 class="usage" style="margin-top: 10px">Usage</h4>
<pre style="margin-bottom: 15px">
printFail [OPTION]... [MESSAGE]
</pre>
<h4 class="usage" style="margin-top: 10px">Options</h4>
<pre style="margin-bottom: 15px">
-l     specify log file to write to
-q     quiet mode. Do not output to stdout, only write to log file if supplied
</pre>
</div>
</li>
<li>
<h4 style="margin-top: 0">printWarn</h4>
<pre>Prints a yellow warning status result <span style="font-family:  'Lucida Console', 'Courier New', Courier, monospace; color: yellow">[ WARN ]</span></pre>
<div>
<h4 class="usage" style="margin-top: 10px">Usage</h4>
<pre style="margin-bottom: 15px">
 printWarn [OPTION]...
</pre>
<h4 class="usage" style="margin-top: 10px">Options</h4>
<pre style="margin-bottom: 15px">
-l     specify log file to write to
-q     quiet mode. Do not output to stdout, only write to log file if supplied
</pre>
</div>
</li>
<li>
<h4 style="margin-top: 0">printInfo</h4>
<pre>Prints a blue info status result <span style="font-family:  'Lucida Console', 'Courier New', Courier, monospace; color: #2E97D7">[ INFO ]</span></pre>
<div>
<h4 class="usage" style="margin-top: 10px">Usage</h4>
<pre style="margin-bottom: 15px">
 printInfo [OPTION]...
</pre>
<h4 class="usage" style="margin-top: 10px">Options</h4>
<pre style="margin-bottom: 15px">
-l     specify log file to write to
-q     quiet mode. Do not output to stdout, only write to log file if supplied
</pre>
</div>
</li>
</ul>
<h2>Example 1</h2>
<p style="margin-top: 10px">Source the bash-beauty.sh file</p>
<pre class="brush: bash; first-line: 1; gutter: true;">. /path/to/bash-beauty.sh</pre>
<p>Execute the printTask function with a description of your task, execute your code, and then execute an appropriate status function: <span style="font-family:  'Lucida Console', 'Courier New', Courier, monospace;">printOk(), printFail(), printWarn(), printInfo()</span></p>
<pre class="brush: bash; first-line: 2; gutter: true;">printTask &quot;Executing arbitrary code&quot;
# your code here
printOk
</pre>
<p>Output</p>
<div class="wp-caption" style="float: left; margin: -15px 0 15px 0">
<img title="bash-beauty #1 example output" src="/img/blog/bash-beauty/bash-beauty-ss4.jpg" alt="bash-beauty #1 example output"/>
</div>
<div style="clear: both"></div>
<h2>Example 2</h2>
<p>If your tasks are commands that print output to stdout/stderr, then you'll probably want to capture their output to keep things looking nice. You may also want to examine each command's result code to determine the appropriate status to print.</p>
<p>This example script attempts to touch file /foo/bar.  If successful, it prints a green status result <span style="font-family:  'Lucida Console', 'Courier New', Courier, monospace; color: green">[  OK  ]</span>.  If unsuccessful, it prints a red failure status result <span style="font-family:  'Lucida Console', 'Courier New', Courier, monospace; color: red">[FAILED]</span>, the error encountered, and exits.</p>
<pre class="brush: bash; first-line: 1; gutter: true;">
#!/bin/bash

# step 1 - source the function library
. ./lib/bash-beauty.sh

# step 2 - use printTask to display the task message
printTask &quot;Attempting to touch /foo/bar&quot;

# step 3 - execute the command,
# redirect command stderr to stdout,
# capture output to variable OUTPUT
OUTPUT=$(touch /foo/bar 2&gt;&amp;1)

# step 4 - examine the command's result code
if [ ! &quot;$?&quot; == 0 ]; then
  printFail &quot;$OUTPUT&quot;
  exit 1
fi
printOk
</pre>
<p>Output</p>
<div class="wp-caption" style="float: left; margin: -15px 0 15px 0">
<img title="bash-beauty example #2 output" src="/img/blog/bash-beauty/bash-beauty-ss5.jpg" alt="bash-beauty example #2 output"/>
</div>
<div style="clear: both"></div>
<h2>Example 3</h2>
<p style="margin-top: 10px">This example script prints to both the terminal and a log file, prefixes each task with a timestamp, and has a custom task message column width.</p>
<pre class="brush: bash; first-line: 1; gutter: true;">
#!/bin/bash

. ./lib/bash-beauty.sh

# set up log file path variable
LOG_FILE=&quot;/tmp/foobar.log&quot;

printTask -t -w 50 -l &quot;$LOG_FILE&quot; &quot;Process running&quot;
sleep 1s    # your code here
printOk -l &quot;$LOG_FILE&quot;

printTask -t -w 50 -l &quot;$LOG_FILE&quot; &quot;Implementing and executing&quot;
sleep 1s
printOk -l &quot;$LOG_FILE&quot;

printTask -t -w 50 -l &quot;$LOG_FILE&quot; &quot;Doing stuff&quot;
sleep 1s
printOk -l &quot;$LOG_FILE&quot;

printTask -t -w 50 -l &quot;$LOG_FILE&quot; &quot;Gittin 'er done&quot;
sleep 1s
printFail -l &quot;$LOG_FILE&quot; &quot;Max hillbilly tolerance level reached&quot;
</pre>
<p>Output to terminal</p>
<div class="wp-caption" style="float: left; margin: -15px 0 15px 0">
<img title="bash-beauty example #2 output" src="/img/blog/bash-beauty/bash-beauty-ss6.jpg" alt="bash-beauty example #3 output"/>
</div>
<div style="clear: both"></div>
<p>Contents of log file at /tmp/foobar.log</p>
<pre class="brush: plain;">
20091114161952  Process running                   [  OK  ]
20091114161953  Implementing and executing        [  OK  ]
20091114161954  Doing stuff                       [  OK  ]
20091114161955  Gittin 'er done                   [FAILED]

Max hillbilly tolerance level reached
</pre>
<h2>Change Log</h2>
<p><strong>0.0.1 - 20091113</strong></p>
<ul>
<li>initial release</li>
</ul>
<div style="margin: 0 auto; text-align: center"><a title="Download" href="/scripts/bash-beauty.sh" target="_blank"><img src="/img/button-dl-orange.png" alt="" width="202" height="62" /></a></div>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=408&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/freebies/bash-beauty-output-for-bash-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svnbak.pl: perl Subversion repository backup script</title>
		<link>http://www.zulius.com/freebies/perl-script-backup-subversion-repositories/</link>
		<comments>http://www.zulius.com/freebies/perl-script-backup-subversion-repositories/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 05:49:34 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[freebies]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://www.zulius.com/blog/?p=167</guid>
		<description><![CDATA[
jQuery(document).ready(function(){jQuery("a[rel='colorbox']").colorbox();});


What is it?

A Perl cron script that creates and rotates backups of one or more Subversion repositories.

What does it do?

Verifies repositories (svnadmin verify)
Hot copies -or- dumps repositories (uses svnadmin hotcopy -or- svnadmin dump)
Archives all repositories to a single tar file
Gzips tar file
Backup rotation

Other Features

Email notifications
Nice output
Free

Requirements
Operating System: *nix
Perl (5.8.5 or higher)
Subversion
tar
gzip

Proc::Reliable
MIME::Lite
Math::Round
Configure
At the top of svnbak.pl [...]]]></description>
			<content:encoded><![CDATA[<div style="margin: 0 auto; text-align: center"><a title="Download" href="http://www.zulius.com/scripts/svnbak.pl-0.0.7.tar.gz" target="_blank"><img src="/img/button-dl-orange.png" alt="" /></a></div>
<div style="float: right; padding: 0 5px; margin: 25px 0 0 0;">
<div class="wp-caption alignright" style="width: 160px"><a href="/img/blog/svnbak.pl/fullsize-ss.png" rel="colorbox"><img title="svnbak.pl executing" src="/img/blog/svnbak.pl/svnbak-titleImage.jpg" alt="svnbak.pl executing" width="150" height="110" /></a><p class="wp-caption-text">svnbak.pl executing</p></div><br />
<script type="text/javascript">jQuery(document).ready(function(){jQuery("a[rel='colorbox']").colorbox();});</script>
</div>
<div style="float: none"></div>
<h2>What is it?</h2>
<p>
A Perl cron script that creates and rotates backups of one or more Subversion repositories.
</p>
<h2>What does it do?</h2>
<ol>
<li>Verifies repositories (<a title="svnadmin verify" href="http://svnbook.red-bean.com/en/1.1/re41.html">svnadmin verify</a>)</li>
<li>Hot copies -or- dumps repositories (uses <a title="svnadmin hotcopy" href="http://svnbook.red-bean.com/en/1.0/re33.html">svnadmin hotcopy</a> -or- <a title="svnadmin dump" href="http://svnbook.red-bean.com/en/1.1/re31.html">svnadmin dump</a>)</li>
<li>Archives all repositories to a single tar file</li>
<li>Gzips tar file</li>
<li>Backup rotation</li>
</ol>
<h2>Other Features</h2>
<ul>
<li>Email notifications</li>
<li>Nice output</li>
<li>Free</li>
</ul>
<h2>Requirements</h2>
<p style="padding-left: 30px;">Operating System: *nix<br />
<a title="Perl" href="http://www.perl.org" target="_blank">Perl</a> (5.8.5 or higher)<br />
<a title="Subversion" href="http://subversion.tigris.org/">Subversion</a><br />
<a title="tar" href="http://www.gnu.org/software/tar/" target="_blank">tar</a><br />
<a title="gzip" href="http://www.gzip.org/" target="_blank">gzip</a>
</p>
<p style="padding-left: 30px;"><a title="Proc::Reliable" href="http://search.cpan.org/~dgold/Proc-Reliable-1.16/Reliable.pm" target="_blank">Proc::Reliable</a><br />
<a title="MIME::Lite" href="http://search.cpan.org/~rjbs/MIME-Lite-3.023/lib/MIME/Lite.pm" target="_blank">MIME::Lite</a><br />
<a title="Math::Round" href="http://search.cpan.org/~grommel/Math-Round-0.05/" target="_blank">Math::Round</a></p>
<h2>Configure</h2>
<div class="wp-caption aligncenter" style="width: 589px"><img style="border: 3px solid #000000;" title="Configuration Section" src="/img/blog/svnbak.pl/ss2.png" alt="svnbak.pl: Configuration Section" width="579" height="207" /><p class="wp-caption-text">svnbak.pl Configuration Section</p></div>
<p>At the top of svnbak.pl is a "Configuration Section" that you must add specific information to in order for the script to work.</p>
<ul>
<li><strong>reposDir</strong>: full path to your Subversion repository, or the parent directory of all your repositories.</li>
<li><strong>destDir</strong>: full path to the directory where the backups should be saved.  To save backups to a network file system, first mount the file system, then specify the mounted path.</li>
<li><strong>maxBaks</strong>: maximum number of backups to retain.  Once this limit is reached, the script will automatically remove the oldest backup based on it's last modified time.</li>
<li><strong>svnBakMethod:</strong> type of Subversion backup to create ('<a title="svnadmin hotcopy" href="http://svnbook.red-bean.com/en/1.0/re33.html">hotcopy</a>' or '<a title="svnadmin dump" href="http://svnbook.red-bean.com/en/1.1/re31.html">dump</a>').</li>
<li><strong>tarballName</strong>: the name of the backup file.  Each backup file will be appended with a 14 digit time stamp to preserve <span>singularity.</span></li>
<li><span><strong>tmpDir</strong>: full path to a <strong>new </strong>temporary directory to store files before tarballing.  This directory should not be an existing directory - it will be deleted!</span></li>
<li><strong>emailPref</strong>: when the admin should receive emails ('always', 'errors', 'none').</li>
<li><strong>displayTime</strong>: display execution time in seconds, per task.</li>
</ul>
<p style="text-align: center;">
<div style="margin: 0 auto; text-align: center"><a title="Download" href="http://www.zulius.com/scripts/svnbak.pl-0.0.7.tar.gz" target="_blank"><img src="/img/button-dl-orange.png" alt="" /></a></div>
<h2>Change Log</h2>
<p><strong>0.0.7 - 20100209</strong></p>
<ul>
<li>fixed failure of external commands running longer than 60 seconds</li>
</ul>
<p><strong>0.0.6 - 20091116</strong></p>
<ul>
<li>fixed fatal error when backing up a single repository</li>
<li>destination directory is created if it does not already exist</li>
<li>changed elapsed time format: 'seconds' -> 's'</li>
</ul>
<p><strong>0.0.5 - 20090326</strong></p>
<ul>
<li>added backup option of dumping repositories via svnadmin dump</li>
<li>increased error checking</li>
<li>fixed: some repositories skipped when there was a large number of repositories</li>
</ul>
<p><strong>0.0.1 - 20090108</strong></p>
<ul>
<li>initial release<strong><br />
</strong></li>
</ul>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=167&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/freebies/perl-script-backup-subversion-repositories/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
