<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>andrewault.net</title>
	
	<link>http://www.andrewault.net</link>
	<description>bloggy blog</description>
	<lastBuildDate>Tue, 14 Feb 2012 17:48:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/andrewault" /><feedburner:info uri="andrewault" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Use Chrome securely from Starbucks via SSH SOCKS</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/9QXvQqtZW9w/</link>
		<comments>http://www.andrewault.net/2012/02/14/use-chrome-securely-from-starbucks-via-ssh-socks/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 17:47:35 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=719</guid>
		<description><![CDATA[OpenSSH makes secure browsing easy. [...]]]></description>
			<content:encoded><![CDATA[<p>Do you have a server that you can access with OpenSSH? Do you want to be able to browse the web, even non-SSL, unencrypted pages, without others on the network being able to see what you&#8217;re looking at or even hijacking your sessions? Given the existence of Firesheep, it is really easy for even unsophisticated users to hijack a web browsing session.</p>
<p>The method I&#8217;m presenting is easy and effective. OpenSSH makes this a snap. Your web browsing packets will be routed via an encrypted connection to your server.</p>
<h2>Create a SOCKS Proxy Connection on localhost</h2>
<p>First, in a terminal, open a SOCKS connection to your server with OpenSSH. Just add &#8220;-D 9999&#8243; to your normal SSH command. This will create a SOCKS proxy on localhost at port 9999.</p>
<pre class="brush: php">
ssh -D 9999 username@myserver.com
</pre>
<p>Depending on your configuration, you may need to enter your server account password. Whatever your normal authentication is for SSH. This will even open a normal SSH session, you will get a shell prompt on the server like normal. If you do not want a shell prompt, use &#8220;-ND&#8221; instead of &#8220;-D&#8221; and the</p>
<p><a href="http://www.andrewault.net/wp-content/uploads/2012/02/switchy_options.png"><img src="http://www.andrewault.net/wp-content/uploads/2012/02/switchy_options-282x300.png" alt="" title="Chrome extension Switchy! options dialog" width="282" height="300" class="alignright size-medium wp-image-721" /></a></p>
<p>You now have a proxy on your local computer using SOCKS on port 9999. Now we just need to use it.</p>
<h2>Install Switchy! in your Chrome browser</h2>
<p>This can be easily found in the Chrome Web Store.</p>
<h2>Use your Shiny New SOCKS Proxy</h2>
<p>Open the Switchy! Options dialog. Type the a name for this proxy in Profile Name. On the SOCKS Host line, enter &#8220;localhost&#8221; in the first blank and &#8220;9999&#8243; for the Port. Click the Save button. You are using a SOCKS proxy running on your localhost.</p>
<p>Then, select the proxy by clicking the Switchy! icon in Chrome and selecting the proxy name you just entered.</p>
<p>You are now using a secure connection to browse the web. Note that someone on the network where your server is hosted can still snoop your traffic, but not in the Starbucks where your are sitting.</p>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F&amp;title=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS&amp;bodytext=OpenSSH%20makes%20secure%20browsing%20easy." title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F&amp;title=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS&amp;notes=OpenSSH%20makes%20secure%20browsing%20easy." title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F&amp;t=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F&amp;title=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F&amp;title=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS&amp;annotation=OpenSSH%20makes%20secure%20browsing%20easy." title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F&amp;title=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F&amp;title=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Use%20Chrome%20securely%20from%20Starbucks%20via%20SSH%20SOCKS%20-%20http%3A%2F%2Fwww.andrewault.net%2F2012%2F02%2F14%2Fuse-chrome-securely-from-starbucks-via-ssh-socks%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/QJgAiMfB8uYWI5eWRABULgmBw1Y/0/da"><img src="http://feedads.g.doubleclick.net/~a/QJgAiMfB8uYWI5eWRABULgmBw1Y/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QJgAiMfB8uYWI5eWRABULgmBw1Y/1/da"><img src="http://feedads.g.doubleclick.net/~a/QJgAiMfB8uYWI5eWRABULgmBw1Y/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/9QXvQqtZW9w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2012/02/14/use-chrome-securely-from-starbucks-via-ssh-socks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2012/02/14/use-chrome-securely-from-starbucks-via-ssh-socks/</feedburner:origLink></item>
		<item>
		<title>View/download a file not in the public directory with PHP</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/BHCmyVsVus0/</link>
		<comments>http://www.andrewault.net/2012/01/28/viewdownload-a-file-not-in-the-public-directory-with-php/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 22:36:42 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=714</guid>
		<description><![CDATA[<p>When you need to give users access to files that are not in the public directory, where you cannot simply use an anchor tag with an &#8220;href&#8221;, you need to do a bit of work. For example, if you&#8217;ve created an authentication system where only authenticated users can download or view a file, this [...]]]></description>
			<content:encoded><![CDATA[<p>When you need to give users access to files that are not in the public directory, where you cannot simply use an anchor tag with an &#8220;href&#8221;, you need to do a bit of work. For example, if you&#8217;ve created an authentication system where only authenticated users can download or view a file, this can be necessary.</p>
<pre class="brush: php">
$filename = &#039;something&#039;;
$file_path = &#039;/somepath/to/the/file/&#039;;
$file_fullpath = $file_path . $filename;
//
//
if (!file_exists($file_fullpath)) {
    header(&quot;HTTP/1.0 404 Not Found&quot;);
    return;
}
//
// get the mime type
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimeType = finfo_file($finfo, $file_fullpath);
//
// calc values for header
$size = filesize($file_fullpath);
$time = date(&#039;r&#039;, filemtime($file_fullpath));
$fm = @fopen($file_fullpath, &#039;rb&#039;);
if (!$fm) {
    header(&#039;HTTP/1.0 505 Internal server error&#039;);
    return;
}
$begin = 0;
$end = $size;
if (isset($_SERVER[&#039;HTTP_RANGE&#039;])) {
    if (preg_match(&#039;/bytes=\h*(\d+)-(\d*)[\D.*]?/i&#039;, $_SERVER[&#039;HTTP_RANGE&#039;], $matches)) {
        $begin = intval($matches[0]);
        if (!empty($matches[1])) $end = intval($matches[1]);
    }
}
//
// create http header
if ($begin &gt; 0 || $end &lt; $size) {
    header(&#039;HTTP/1.0 206 Partial Content&#039;);
}else {
    header(&#039;HTTP/1.0 200 OK&#039;);
}
header(&#039;HTTP/1.0 200 OK&#039;);
header(&quot;Content-Type: $mimeType&quot;);
header(&#039;Cache-Control: public, must-revalidate, max-age=0&#039;);
header(&#039;Pragma: no-cache&#039;);
header(&#039;Accept-Ranges: bytes&#039;);
header(&#039;Content-Length:&#039; . ($end - $begin));
header(&quot;Content-Range: bytes $begin-$end/$size&quot;);
header(&quot;Content-Disposition: inline; filename=$filename&quot;);
header(&quot;Content-Transfer-Encoding: binary\n&quot;);
header(&quot;Last-Modified: $time&quot;);
header(&#039;Connection: close&#039;);
// output the file
$cur = $begin;
fseek($fm, $begin, 0);
while (!feof($fm) &amp;&amp; $cur &lt; $end &amp;&amp; (connection_status() == 0)) {
    print fread($fm, min(1024 * 16, $end - $cur));
    $cur+= 1024 * 16;
}
</pre>
<p>There you have it. Your user can click the link for the file, which then runs this code. In my case, this is in a Kohana controller.</p>
<p>The files are not stored in a public directory, so unauthenticated users cannot access them.</p>
<p>If a file is created on the fly, like a PDF of an invoice, this will also work.</p>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F&amp;title=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP&amp;bodytext=When%20you%20need%20to%20give%20users%20access%20to%20files%20that%20are%20not%20in%20the%20public%20directory%2C%20where%20you%20cannot%20simply%20use%20an%20anchor%20tag%20with%20an%20%22href%22%2C%20you%20need%20to%20do%20a%20bit%20of%20work.%20For%20example%2C%20if%20you%27ve%20created%20an%20authentication%20system%20where%20only%20authenticated" title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F&amp;title=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP&amp;notes=When%20you%20need%20to%20give%20users%20access%20to%20files%20that%20are%20not%20in%20the%20public%20directory%2C%20where%20you%20cannot%20simply%20use%20an%20anchor%20tag%20with%20an%20%22href%22%2C%20you%20need%20to%20do%20a%20bit%20of%20work.%20For%20example%2C%20if%20you%27ve%20created%20an%20authentication%20system%20where%20only%20authenticated" title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F&amp;t=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F&amp;title=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F&amp;title=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP&amp;annotation=When%20you%20need%20to%20give%20users%20access%20to%20files%20that%20are%20not%20in%20the%20public%20directory%2C%20where%20you%20cannot%20simply%20use%20an%20anchor%20tag%20with%20an%20%22href%22%2C%20you%20need%20to%20do%20a%20bit%20of%20work.%20For%20example%2C%20if%20you%27ve%20created%20an%20authentication%20system%20where%20only%20authenticated" title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F&amp;title=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F&amp;title=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=View%2Fdownload%20a%20file%20not%20in%20the%20public%20directory%20with%20PHP%20-%20http%3A%2F%2Fwww.andrewault.net%2F2012%2F01%2F28%2Fviewdownload-a-file-not-in-the-public-directory-with-php%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/NHro8oPNZppGevx880Ix6v4cu5w/0/da"><img src="http://feedads.g.doubleclick.net/~a/NHro8oPNZppGevx880Ix6v4cu5w/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/NHro8oPNZppGevx880Ix6v4cu5w/1/da"><img src="http://feedads.g.doubleclick.net/~a/NHro8oPNZppGevx880Ix6v4cu5w/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/BHCmyVsVus0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2012/01/28/viewdownload-a-file-not-in-the-public-directory-with-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2012/01/28/viewdownload-a-file-not-in-the-public-directory-with-php/</feedburner:origLink></item>
		<item>
		<title>Rename a bunch of files on a Mac (Linux too)</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/N6uUC4jLVfk/</link>
		<comments>http://www.andrewault.net/2011/06/24/rename-a-bunch-of-files-on-a-mac-linux-too/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 23:38:30 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[rename]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=703</guid>
		<description><![CDATA[<p>I misspelled a word when I exported a large group of photos from Aperture. I did not want to repeat the operation, so I renamed the files at a bash prompt in Terminal:</p> for FILE in * ; do NEWNAME=`echo $FILE &#124; sed &#039;s/oldstring/newstring/g&#039; ` ; mv &#34;$FILE&#34; &#34;$NEWNAME&#34; ; done <p>Just change &#8216;oldstring&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>I misspelled a word when I exported a large group of photos from Aperture. I did not want to repeat the operation, so I renamed the files at a bash prompt in Terminal:</p>
<pre class="brush: php">
for FILE in * ; do NEWNAME=`echo $FILE | sed &#039;s/oldstring/newstring/g&#039; ` ; mv &quot;$FILE&quot; &quot;$NEWNAME&quot; ; done
</pre>
<p>Just change &#8216;oldstring&#8217; and &#8216;newstring&#8217; to the values needed.</p>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F&amp;title=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29&amp;bodytext=I%20misspelled%20a%20word%20when%20I%20exported%20a%20large%20group%20of%20photos%20from%20Aperture.%20I%20did%20not%20want%20to%20repeat%20the%20operation%2C%20so%20I%20renamed%20the%20files%20at%20a%20bash%20prompt%20in%20Terminal%3A%0D%0A%0D%0A%5Bsourcecode%5D%0D%0Afor%20FILE%20in%20%2A%20%3B%20do%20NEWNAME%3D%60echo%20%24FILE%20%7C%20sed%20%27s%2Foldstring%2Fnewstri" title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F&amp;title=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29&amp;notes=I%20misspelled%20a%20word%20when%20I%20exported%20a%20large%20group%20of%20photos%20from%20Aperture.%20I%20did%20not%20want%20to%20repeat%20the%20operation%2C%20so%20I%20renamed%20the%20files%20at%20a%20bash%20prompt%20in%20Terminal%3A%0D%0A%0D%0A%5Bsourcecode%5D%0D%0Afor%20FILE%20in%20%2A%20%3B%20do%20NEWNAME%3D%60echo%20%24FILE%20%7C%20sed%20%27s%2Foldstring%2Fnewstri" title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F&amp;t=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F&amp;title=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F&amp;title=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29&amp;annotation=I%20misspelled%20a%20word%20when%20I%20exported%20a%20large%20group%20of%20photos%20from%20Aperture.%20I%20did%20not%20want%20to%20repeat%20the%20operation%2C%20so%20I%20renamed%20the%20files%20at%20a%20bash%20prompt%20in%20Terminal%3A%0D%0A%0D%0A%5Bsourcecode%5D%0D%0Afor%20FILE%20in%20%2A%20%3B%20do%20NEWNAME%3D%60echo%20%24FILE%20%7C%20sed%20%27s%2Foldstring%2Fnewstri" title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F&amp;title=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F&amp;title=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Rename%20a%20bunch%20of%20files%20on%20a%20Mac%20%28Linux%20too%29%20-%20http%3A%2F%2Fwww.andrewault.net%2F2011%2F06%2F24%2Frename-a-bunch-of-files-on-a-mac-linux-too%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/Hex8-cYogLcxpEvVtI0AAzWA9-w/0/da"><img src="http://feedads.g.doubleclick.net/~a/Hex8-cYogLcxpEvVtI0AAzWA9-w/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Hex8-cYogLcxpEvVtI0AAzWA9-w/1/da"><img src="http://feedads.g.doubleclick.net/~a/Hex8-cYogLcxpEvVtI0AAzWA9-w/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/N6uUC4jLVfk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2011/06/24/rename-a-bunch-of-files-on-a-mac-linux-too/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2011/06/24/rename-a-bunch-of-files-on-a-mac-linux-too/</feedburner:origLink></item>
		<item>
		<title>Perl script to get video details</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/7HByvWZMaGE/</link>
		<comments>http://www.andrewault.net/2010/07/09/perl-script-to-get-video-details/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 16:48:15 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[command line]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=682</guid>
		<description><![CDATA[<p>This is a command line Perl script I made a while back to simply show details about a specified video. It is tested on Ubuntu.</p> <p>You can modify it for your specific requirements or grab some code for another use.</p> #!/usr/bin/perl -w use strict; use warnings; use IPC::Open3; # example my $filename = $ARGV[0]; [...]]]></description>
			<content:encoded><![CDATA[<p>This is a command line Perl script I made a while back to simply show details about a specified video. It is tested on Ubuntu.</p>
<p>You can modify it for your specific requirements or grab some code for another use.</p>
<pre class="brush: php">
#!/usr/bin/perl -w
use strict;
use warnings;

use IPC::Open3;

# example
my $filename  = $ARGV[0];
my %videoInfo = videoInfo($filename);
print &quot;duration: &quot; . $videoInfo{&#039;duration&#039;} . &quot;\n&quot;;
print &quot;durationsecs: &quot; . $videoInfo{&#039;durationsecs&#039;} . &quot;\n&quot;;
print &quot;bitrate: &quot; . $videoInfo{&#039;bitrate&#039;} . &quot;\n&quot;;
print &quot;vcodec: &quot; . $videoInfo{&#039;vcodec&#039;} . &quot;\n&quot;;
print &quot;vformat: &quot; . $videoInfo{&#039;vformat&#039;} . &quot;\n&quot;;
print &quot;acodec: &quot; . $videoInfo{&#039;acodec&#039;} . &quot;\n&quot;;
print &quot;asamplerate: &quot; . $videoInfo{&#039;asamplerate&#039;} . &quot;\n&quot;;
print &quot;achannels: &quot; . $videoInfo{&#039;achannels&#039;} . &quot;\n&quot;;

#
# returns media information in a hash
sub videoInfo {
	# ffmpeg command
	my $ffmpeg = &#039;/usr/local/bin/ffmpeg&#039;;

	my %finfo = (
				  &#039;duration&#039;     =&gt; &quot;00:00:00.00&quot;,
				  &#039;durationsecs&#039; =&gt; &quot;0&quot;,
				  &#039;bitrate&#039;      =&gt; &quot;0&quot;,
				  &#039;vcodec&#039;       =&gt; &quot;&quot;,
				  &#039;vformat&#039;      =&gt; &quot;&quot;,
				  &#039;acodec&#039;       =&gt; &quot;&quot;,
				  &#039;asamplerate&#039;   =&gt; &quot;0&quot;,
				  &#039;achannels&#039;       =&gt; &quot;0&quot;,
	);

	my $file = shift;

	# escaping characters
	$file =~ s/(\W)/\\$1/g;

	open3( &quot;&lt;/dev/null&quot;, &quot;&gt;/dev/null&quot;, \*ERPH, &quot;$ffmpeg -i $file&quot; ) or die &quot;can&#039;t run $ffmpeg\n&quot;;
	my @res = &lt;ERPH&gt;;

	# parse ffmpeg output
	foreach (@res) {
        print;

		# duration
		if (m!Duration: ([0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9])!) {
			$finfo{&#039;duration&#039;} = $1;
		}

		# bitrate
		if (m!bitrate: (\d*) kb/s!) {
			$finfo{&#039;bitrate&#039;} = $1;
		}

		# vcodec and vformat
		if (/Video: (\w*), (\w*),/) {
			$finfo{&#039;vcodec&#039;}  = $1;
			$finfo{&#039;vformat&#039;} = $2;
		}

        # Stream #0.1(und): Audio: aac, 48000 Hz, 1 channels, s16, 64 kb/s

		# acodec, samplerate, stereo and audiorate
		if (m!Audio: (\w*), (\d*) Hz, (\d*)!) {
			$finfo{&#039;acodec&#039;}     = $1;
			$finfo{&#039;asamplerate&#039;} = $2;
			$finfo{&#039;achannels&#039;}     = $3;
		}
	}

	my $tenths  = substr( $finfo{&#039;duration&#039;}, 9, 2 );
	my $seconds = substr( $finfo{&#039;duration&#039;}, 6, 2 );
	my $minutes = substr( $finfo{&#039;duration&#039;}, 3, 2 );
	my $hours   = substr( $finfo{&#039;duration&#039;}, 0, 2 );
	$finfo{&#039;durationsecs&#039;} = ( $tenths * .01 ) + $seconds + ( $minutes * 60 ) + ( $hours * 360 );

	return %finfo;
}
</pre>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F&amp;title=Perl%20script%20to%20get%20video%20details&amp;bodytext=This%20is%20a%20command%20line%20Perl%20script%20I%20made%20a%20while%20back%20to%20simply%20show%20details%20about%20a%20specified%20video.%20It%20is%20tested%20on%20Ubuntu.%0D%0A%0D%0AYou%20can%20modify%20it%20for%20your%20specific%20requirements%20or%20grab%20some%20code%20for%20another%20use.%0D%0A%0D%0A%5Bsourcecode%5D%0D%0A%23%21%2Fusr%2Fbin%2Fperl%20-w%0D" title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F&amp;title=Perl%20script%20to%20get%20video%20details&amp;notes=This%20is%20a%20command%20line%20Perl%20script%20I%20made%20a%20while%20back%20to%20simply%20show%20details%20about%20a%20specified%20video.%20It%20is%20tested%20on%20Ubuntu.%0D%0A%0D%0AYou%20can%20modify%20it%20for%20your%20specific%20requirements%20or%20grab%20some%20code%20for%20another%20use.%0D%0A%0D%0A%5Bsourcecode%5D%0D%0A%23%21%2Fusr%2Fbin%2Fperl%20-w%0D" title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F&amp;t=Perl%20script%20to%20get%20video%20details" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F&amp;title=Perl%20script%20to%20get%20video%20details" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F&amp;title=Perl%20script%20to%20get%20video%20details&amp;annotation=This%20is%20a%20command%20line%20Perl%20script%20I%20made%20a%20while%20back%20to%20simply%20show%20details%20about%20a%20specified%20video.%20It%20is%20tested%20on%20Ubuntu.%0D%0A%0D%0AYou%20can%20modify%20it%20for%20your%20specific%20requirements%20or%20grab%20some%20code%20for%20another%20use.%0D%0A%0D%0A%5Bsourcecode%5D%0D%0A%23%21%2Fusr%2Fbin%2Fperl%20-w%0D" title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Perl%20script%20to%20get%20video%20details&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F&amp;title=Perl%20script%20to%20get%20video%20details" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Perl%20script%20to%20get%20video%20details&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F&amp;title=Perl%20script%20to%20get%20video%20details" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Perl%20script%20to%20get%20video%20details%20-%20http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F09%2Fperl-script-to-get-video-details%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/1GDkAhTBJOr5Oovt7V043q8rTzk/0/da"><img src="http://feedads.g.doubleclick.net/~a/1GDkAhTBJOr5Oovt7V043q8rTzk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/1GDkAhTBJOr5Oovt7V043q8rTzk/1/da"><img src="http://feedads.g.doubleclick.net/~a/1GDkAhTBJOr5Oovt7V043q8rTzk/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/7HByvWZMaGE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2010/07/09/perl-script-to-get-video-details/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2010/07/09/perl-script-to-get-video-details/</feedburner:origLink></item>
		<item>
		<title>Create a Drupal site on an Ubuntu Server</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/5ecB-s5tWKc/</link>
		<comments>http://www.andrewault.net/2010/07/06/create-a-drupal-site-on-an-ubuntu-server/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 22:11:53 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=660</guid>
		<description><![CDATA[<p>This will help you quickly install a Drupal site on an Ubuntu server.</p> <p>This is my script for this purpose. Use it as you will. This procedure assumes that you have already installed Apache, MySQL, phpMyAdmin and PHP. It also assumes that you are familiar with everything. This is probably not a beginner&#8217;s guide, [...]]]></description>
			<content:encoded><![CDATA[<p>This will help you quickly install a Drupal site on an Ubuntu server.</p>
<p>This is my script for this purpose. Use it as you will. This procedure assumes that you have already installed Apache, MySQL, phpMyAdmin and PHP. It also assumes that you are familiar with everything. This is probably not a beginner&#8217;s guide, but an aid to someone more experienced that wants to install Drupal quickly.</p>
<h3>Create and run a shell script to create your site</h3>
<p>Use this template to create a shell script that will create your site. Create a text file from the following template called &#8220;make_dru.sh&#8221; (in your home directory is fine). Modify lines 7 to 17 for your installation. Then use &#8220;chmod +x make_dru.sh&#8221; and execute the script with &#8220;sudo ./make_dru.sh&#8221;.</p>
<pre class="brush: php">
#!/bin/bash
#
# make drupal project
#

#
OWNER=&quot;andrew&quot; 			# change to your username
GROUP=&quot;staff&quot;			# change to your username or the group that will work on the site
DRUPAL_URL=&quot;http://ftp.drupal.org/files/projects/drupal-6.17.tar.gz&quot; # update to the current version, if there is one
SITESROOT=&quot;/usr/local/var/www&quot;  # change to the directory where you put website directories
URL=&quot;www.sitename.com&quot;		# change to your site&#039;s address

# database.php parameters
DBUSER=&quot;sitename&quot;		# change to something meaningful
DBPWD=&quot;passwordgoeshere&quot;		# change to a long password
DBHOST=&quot;localhost&quot;		# leave alone
DBDATABASE=$DBUSER		# leave alone

#
# make sure this is run as root
#
if [[ $UID -ne 0 ]]; then
    echo &quot;Not running as root&quot;
    exit
fi

if [ ! -d $SITESROOT ]; then
	echo &quot;$SITESROOT directory does not exist&quot;
	exit
fi

#
# check for existence of the specified user owner
#
/bin/egrep  -i &quot;^$OWNER&quot; /etc/passwd &gt; /dev/null
if [ ! $? -eq 0 ]; then
   echo &quot;User $OWNER, which is specified as the owner, does not exist in /etc/passwd&quot;
   exit
fi

#
# check for existence of the specified group
#
/bin/egrep -i &quot;^$GROUP&quot; /etc/group &gt; /dev/null
if [ ! $? -eq 0 ]; then
   echo &quot;$GROUP, which is specified as the group to use, does not exist in /etc/group&quot;
   exit
fi

#
# change to the siteroot directory
#
cd $SITESROOT

if [ -d $URL ]; then
	echo &quot;$SITESROOT/$URL directory already exists&quot;
	exit
fi 

mkdir $URL
chown $OWNER:$GROUP $URL
cd $URL

#
# get Drupal
#
echo &#039;get Drupal&#039;
wget -O drupal.tgz $DRUPAL_URL
tar -xzvf drupal.tgz
find . -maxdepth 1 -type d -name &#039;drupal*&#039; -exec mv {} public \;
sudo chown -R $OWNER:$GROUP public
find . -type d -exec chmod g+ws {} \;

#
# temporarily allow write to settings
#
cp public/sites/default/default.settings.php public/sites/default/settings.php
chmod a+w public/sites/default/settings.php
chmod a+w public/sites/default

#
# logs
#
echo &quot;set up logs&quot;
mkdir logs
sudo chown $OWNER:www-data logs
chmod g+ws logs
touch logs/error.log
touch logs/combined.log

#
# create Apache virtual site
#
echo creating Apache virtual site file in /etc/apache2/sites-available
echo &quot;&lt;VirtualHost *:80&gt;
	ServerName $URL
	DocumentRoot $SITESROOT/$URL/public
	DirectoryIndex index.php
	LogLevel warn
	ErrorLog $SITESROOT/$URL/logs/error.log
	CustomLog $SITESROOT/$URL/logs/combined.log combined
&lt;/VirtualHost&gt;
&quot; &gt; /etc/apache2/sites-available/$URL

#
# finish up
#
echo -e &quot;Drupal website was created in: $SITESROOT/$URL\n&quot;
echo -e &quot;To finish, do the following:\n&quot;
echo &quot;1. Enable site with: sudo a2ensite $URL&quot;
echo &quot;2. Restart Apache with: sudo /etc/init.d/apache2 restart&quot;
echo &quot;3. Make a crontab entry (&#039;sudo crontab -e&#039;) like: 0 * * * * wget -O - -q -t 1 http://$URL/cron.php&quot;
echo -e &quot;4. Create a MySQL database with:\n&quot;
echo -e &quot;\t     user: $DBUSER&quot;
echo -e &quot;\t      pwd: $DBPWD&quot;
echo -e &quot;\t     host: $DBHOST&quot;
echo -e &quot;\t database: $DBDATABASE&quot;
echo &quot;5. Open the site in your browser and finish the set-up.&quot;
echo &quot;6. Remove write privileges with: sudo chmod og-w public/sites/default/settings.php&quot;
echo &quot;   ..and: sudo chmod og-w public/sites/default&quot;
</pre>
<h3>Create the database and user with phpMyAdmin</h3>
<ul>
<li>click the &#8220;Privileges&#8221; tab and add a new user</li>
<li>in the &#8220;User name&#8221; field, enter the sitename that you entered for DBUSER in the script</li>
<li>in the Host field, select &#8220;Local&#8221;</li>
<li>enter or generate a password &#8211; make it a long one, like 20 characters</li>
<li>in the Database for User list, select &#8220;Create database with same name and grant all privileges&#8221;</li>
<li>click Go</li>
</ul>
<h3>Enable the new Drupal website</h3>
<p>This will tell Apache to enable the virtual site that was made in the script and then restart Apache.</p>
<pre class="brush: php">
sudo a2ensite www.sitename.com
sudo /etc/init.d/apache2 restart
</pre>
<h3>Configure the site</h3>
<p>Open site in browser and configure it</p>
<h3>Remove temporary write privileges</h3>
<p>During site creation, write privileges were needed, after site set-up, remove them. In a shell, while in the sites directory (where the public directory is run these commands:</p>
<pre class="brush: php">
sudo chmod og-w public/sites/default/settings.php
sudo chmod og-w public/sites/default
</pre>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F&amp;title=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server&amp;bodytext=This%20will%20help%20you%20quickly%20install%20a%20Drupal%20site%20on%20an%20Ubuntu%20server.%0D%0A%0D%0AThis%20is%20my%20script%20for%20this%20purpose.%20Use%20it%20as%20you%20will.%20This%20procedure%20assumes%20that%20you%20have%20already%20installed%20Apache%2C%20MySQL%2C%20phpMyAdmin%20and%20PHP.%20It%20also%20assumes%20that%20you%20are%20fa" title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F&amp;title=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server&amp;notes=This%20will%20help%20you%20quickly%20install%20a%20Drupal%20site%20on%20an%20Ubuntu%20server.%0D%0A%0D%0AThis%20is%20my%20script%20for%20this%20purpose.%20Use%20it%20as%20you%20will.%20This%20procedure%20assumes%20that%20you%20have%20already%20installed%20Apache%2C%20MySQL%2C%20phpMyAdmin%20and%20PHP.%20It%20also%20assumes%20that%20you%20are%20fa" title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F&amp;t=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F&amp;title=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F&amp;title=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server&amp;annotation=This%20will%20help%20you%20quickly%20install%20a%20Drupal%20site%20on%20an%20Ubuntu%20server.%0D%0A%0D%0AThis%20is%20my%20script%20for%20this%20purpose.%20Use%20it%20as%20you%20will.%20This%20procedure%20assumes%20that%20you%20have%20already%20installed%20Apache%2C%20MySQL%2C%20phpMyAdmin%20and%20PHP.%20It%20also%20assumes%20that%20you%20are%20fa" title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F&amp;title=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F&amp;title=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Create%20a%20Drupal%20site%20on%20an%20Ubuntu%20Server%20-%20http%3A%2F%2Fwww.andrewault.net%2F2010%2F07%2F06%2Fcreate-a-drupal-site-on-an-ubuntu-server%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/8rGgXWNRR-3hNVaZAvgCsNV-5t0/0/da"><img src="http://feedads.g.doubleclick.net/~a/8rGgXWNRR-3hNVaZAvgCsNV-5t0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/8rGgXWNRR-3hNVaZAvgCsNV-5t0/1/da"><img src="http://feedads.g.doubleclick.net/~a/8rGgXWNRR-3hNVaZAvgCsNV-5t0/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/5ecB-s5tWKc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2010/07/06/create-a-drupal-site-on-an-ubuntu-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2010/07/06/create-a-drupal-site-on-an-ubuntu-server/</feedburner:origLink></item>
		<item>
		<title>Linux command line language translator</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/fViCQDPhjFM/</link>
		<comments>http://www.andrewault.net/2010/06/23/linux-command-line-language-translator/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 18:46:11 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=653</guid>
		<description><![CDATA[<p>I wanted a command language translator that can be used in bash shell scripts. There are a couple of options available, but none that were versatile enough. A little research resulted in finding that Google Translate offered what I wanted and that there was a JSON interface, which I could use with Perl&#8217;s JSON [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted a command language translator that can be used in bash shell scripts. There are a couple of options available, but none that were versatile enough. A little research resulted in finding that <a href="http://translate.google.com/">Google Translate</a> offered what I wanted and that there was a JSON interface, which I could use with Perl&#8217;s <a href="http://search.cpan.org/~makamaka/JSON-2.21/lib/JSON.pm">JSON module</a>.</p>
<p>I added a few niceties such as help, multiple source options and a listing of available languages.</p>
<p>Entering:</p>
<p><strong>tranny -t de &#8216;I am a citizen of Berlin&#8217;</strong></p>
<p>gets this result:</p>
<p><strong>Ich bin ein Bürger von Berlin</strong></p>
<p>and entering:</p>
<p><strong>tranny &#8216;Ich bin ein Bürger von Berlin&#8217;</strong></p>
<p>results:</p>
<p><strong>I am a citizen of Berlin</strong></p>
<p>I created a Google Code project for tranny at: <a href="http://code.google.com/p/tranny/">http://code.google.com/p/tranny/</a></p>
<p>If you need a scriptable translator, give it a try. If you run into trouble or would like to suggest changes, leave comments here or at the <a href="http://code.google.com/p/tranny/">project</a>.</p>
<pre class="brush: php">
#!/usr/bin/perl
#
# what:      tranny, a language translator
# project:   https://code.google.com/p/tranny/
# copyright: Copyright 2010, Andrew Ault
# license:   This content is released under the  http://code.google.com/p/tranny/wiki/license MIT License.
#
# Uses the JSON module from CPAN. To install: &quot;sudo cpan JSON&quot;
#

use strict;
use warnings;
use POSIX;
use Getopt::Std;
use JSON;
use LWP;

require &#039;sys/ioctl.ph&#039;;
die &quot;no TIOCGWINSZ &quot; unless defined &amp;TIOCGWINSZ;

my $original;
my $winsize;
my $has_tty = 1;
my ( $screen_rows, $screen_cols, $screen_xpixels, $screen_ypixels );

my %languages = (
				  &#039;afrikaans&#039;      =&gt; &#039;af&#039;,
				  &#039;albanian&#039;       =&gt; &#039;sq&#039;,
				  &#039;amharic&#039;        =&gt; &#039;am&#039;,
				  &#039;arabic&#039;         =&gt; &#039;ar&#039;,
				  &#039;armenian&#039;       =&gt; &#039;hy&#039;,
				  &#039;azerbaijani&#039;    =&gt; &#039;az&#039;,
				  &#039;basque&#039;         =&gt; &#039;eu&#039;,
				  &#039;belarusian&#039;     =&gt; &#039;be&#039;,
				  &#039;bengali&#039;        =&gt; &#039;bn&#039;,
				  &#039;bihari&#039;         =&gt; &#039;bh&#039;,
				  &#039;breton&#039;         =&gt; &#039;br&#039;,
				  &#039;bulgarian&#039;      =&gt; &#039;bg&#039;,
				  &#039;burmese&#039;        =&gt; &#039;my&#039;,
				  &#039;catalan&#039;        =&gt; &#039;ca&#039;,
				  &#039;cherokee&#039;       =&gt; &#039;chr&#039;,
				  &#039;chinese&#039;        =&gt; &#039;zh&#039;,
				  &#039;chinese simp&#039;   =&gt; &#039;zh-cn&#039;,
				  &#039;chinese trad&#039;   =&gt; &#039;zh-tw&#039;,
				  &#039;corsican&#039;       =&gt; &#039;co&#039;,
				  &#039;croatian&#039;       =&gt; &#039;hr&#039;,
				  &#039;czech&#039;          =&gt; &#039;cs&#039;,
				  &#039;danish&#039;         =&gt; &#039;da&#039;,
				  &#039;dhivehi&#039;        =&gt; &#039;dv&#039;,
				  &#039;dutch&#039;          =&gt; &#039;nl&#039;,
				  &#039;english&#039;        =&gt; &#039;en&#039;,
				  &#039;esperanto&#039;      =&gt; &#039;eo&#039;,
				  &#039;estonian&#039;       =&gt; &#039;et&#039;,
				  &#039;faroese&#039;        =&gt; &#039;fo&#039;,
				  &#039;filipino&#039;       =&gt; &#039;tl&#039;,
				  &#039;finnish&#039;        =&gt; &#039;fi&#039;,
				  &#039;french&#039;         =&gt; &#039;fr&#039;,
				  &#039;frisian&#039;        =&gt; &#039;fy&#039;,
				  &#039;galician&#039;       =&gt; &#039;gl&#039;,
				  &#039;georgian&#039;       =&gt; &#039;ka&#039;,
				  &#039;german&#039;         =&gt; &#039;de&#039;,
				  &#039;greek&#039;          =&gt; &#039;el&#039;,
				  &#039;gujarati&#039;       =&gt; &#039;gu&#039;,
				  &#039;haitian creole&#039; =&gt; &#039;ht&#039;,
				  &#039;hebrew&#039;         =&gt; &#039;iw&#039;,
				  &#039;hindi&#039;          =&gt; &#039;hi&#039;,
				  &#039;hungarian&#039;      =&gt; &#039;hu&#039;,
				  &#039;icelandic&#039;      =&gt; &#039;is&#039;,
				  &#039;indonesian&#039;     =&gt; &#039;id&#039;,
				  &#039;inuktitut&#039;      =&gt; &#039;iu&#039;,
				  &#039;irish&#039;          =&gt; &#039;ga&#039;,
				  &#039;italian&#039;        =&gt; &#039;it&#039;,
				  &#039;japanese&#039;       =&gt; &#039;ja&#039;,
				  &#039;javanese&#039;       =&gt; &#039;jw&#039;,
				  &#039;kannada&#039;        =&gt; &#039;kn&#039;,
				  &#039;kazakh&#039;         =&gt; &#039;kk&#039;,
				  &#039;khmer&#039;          =&gt; &#039;km&#039;,
				  &#039;korean&#039;         =&gt; &#039;ko&#039;,
				  &#039;kurdish&#039;        =&gt; &#039;ku&#039;,
				  &#039;kyrgyz&#039;         =&gt; &#039;ky&#039;,
				  &#039;lao&#039;            =&gt; &#039;lo&#039;,
				  &#039;latin&#039;          =&gt; &#039;la&#039;,
				  &#039;latvian&#039;        =&gt; &#039;lv&#039;,
				  &#039;lithuanian&#039;     =&gt; &#039;lt&#039;,
				  &#039;luxembourgish&#039;  =&gt; &#039;lb&#039;,
				  &#039;macedonian&#039;     =&gt; &#039;mk&#039;,
				  &#039;malay&#039;          =&gt; &#039;ms&#039;,
				  &#039;malayalam&#039;      =&gt; &#039;ml&#039;,
				  &#039;maltese&#039;        =&gt; &#039;mt&#039;,
				  &#039;maori&#039;          =&gt; &#039;mi&#039;,
				  &#039;marathi&#039;        =&gt; &#039;mr&#039;,
				  &#039;mongolian&#039;      =&gt; &#039;mn&#039;,
				  &#039;nepali&#039;         =&gt; &#039;ne&#039;,
				  &#039;norwegian&#039;      =&gt; &#039;no&#039;,
				  &#039;occitan&#039;        =&gt; &#039;oc&#039;,
				  &#039;oriya&#039;          =&gt; &#039;or&#039;,
				  &#039;pashto&#039;         =&gt; &#039;ps&#039;,
				  &#039;persian&#039;        =&gt; &#039;fa&#039;,
				  &#039;polish&#039;         =&gt; &#039;pl&#039;,
				  &#039;portuguese&#039;     =&gt; &#039;pt&#039;,
				  &#039;punjabi&#039;        =&gt; &#039;pa&#039;,
				  &#039;quechua&#039;        =&gt; &#039;qu&#039;,
				  &#039;romanian&#039;       =&gt; &#039;ro&#039;,
				  &#039;russian&#039;        =&gt; &#039;ru&#039;,
				  &#039;sanskrit&#039;       =&gt; &#039;sa&#039;,
				  &#039;scots_gaelic&#039;   =&gt; &#039;gd&#039;,
				  &#039;serbian&#039;        =&gt; &#039;sr&#039;,
				  &#039;sindhi&#039;         =&gt; &#039;sd&#039;,
				  &#039;sinhalese&#039;      =&gt; &#039;si&#039;,
				  &#039;slovak&#039;         =&gt; &#039;sk&#039;,
				  &#039;slovenian&#039;      =&gt; &#039;sl&#039;,
				  &#039;spanish&#039;        =&gt; &#039;es&#039;,
				  &#039;sundanese&#039;      =&gt; &#039;su&#039;,
				  &#039;swahili&#039;        =&gt; &#039;sw&#039;,
				  &#039;swedish&#039;        =&gt; &#039;sv&#039;,
				  &#039;syriac&#039;         =&gt; &#039;syr&#039;,
				  &#039;tajik&#039;          =&gt; &#039;tg&#039;,
				  &#039;tamil&#039;          =&gt; &#039;ta&#039;,
				  &#039;tatar&#039;          =&gt; &#039;tt&#039;,
				  &#039;telugu&#039;         =&gt; &#039;te&#039;,
				  &#039;thai&#039;           =&gt; &#039;th&#039;,
				  &#039;tibetan&#039;        =&gt; &#039;bo&#039;,
				  &#039;tonga&#039;          =&gt; &#039;to&#039;,
				  &#039;turkish&#039;        =&gt; &#039;tr&#039;,
				  &#039;ukrainian&#039;      =&gt; &#039;uk&#039;,
				  &#039;urdu&#039;           =&gt; &#039;ur&#039;,
				  &#039;uzbek&#039;          =&gt; &#039;uz&#039;,
				  &#039;uighur&#039;         =&gt; &#039;ug&#039;,
				  &#039;vietnamese&#039;     =&gt; &#039;vi&#039;,
				  &#039;welsh&#039;          =&gt; &#039;cy&#039;,
				  &#039;yiddish&#039;        =&gt; &#039;yi&#039;,
				  &#039;yoruba&#039;         =&gt; &#039;yo&#039;,
);

# get window size for country listing
open( TTY, &quot;+&lt;/dev/tty&quot; ) or $has_tty = 0;
if ($has_tty) {
	unless ( ioctl( TTY, &amp;TIOCGWINSZ, $winsize = &#039;&#039; ) ) {
		die sprintf &quot;$0: ioctl TIOCGWINSZ (%08x: $!)\n&quot;, &amp;TIOCGWINSZ;
	}
	( $screen_rows, $screen_cols, $screen_xpixels, $screen_ypixels ) = unpack( &#039;S4&#039;, $winsize );
}

getopts( &#039;f:t:o:hl&#039;, \my %opts );
if ( defined $opts{h} &amp;&amp; $opts{h} == 1 ) { usage() }
if ( defined $opts{l} &amp;&amp; $opts{l} == 1 ) { usage() }
my ( $from, $to ) = ( $opts{f}, $opts{t} );
if ( !defined $opts{f} ) { $from = &#039;&#039;; }
if ( !defined $opts{t} ) { $to   = &#039;en&#039;; }

# if text was passed on the command line
if ( defined $ARGV[0] ) {
	$original = $ARGV[0];
# text is from a file
} elsif ( defined $opts{o} ) {
	# slurp from file
	open FILE, $opts{o} or die &quot;-o argument: couldn&#039;t open file: $!&quot;;
	local $/ = undef;
	$original = &lt;FILE&gt;;
	close FILE;
# text is from STDIN
} else {
	# slurp STDIN
	local $/ = undef;
	$original = &lt;STDIN&gt;;
}

my $ua = LWP::UserAgent-&gt;new;
$ua-&gt;agent(&quot;PGDict/1.0&quot;);
my $request =
  HTTP::Request-&gt;new( GET =&gt; &quot;http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&amp;langpair=$from|$to&amp;q=$original&quot; );
my $response = $ua-&gt;request($request);

if ( $response-&gt;is_success ) {
	my $perl_res = from_json( $response-&gt;content );
	if ( $perl_res-&gt;{&#039;responseStatus&#039;} eq &#039;200&#039; ) {
		print $perl_res-&gt;{&#039;responseData&#039;}-&gt;{&#039;translatedText&#039;} . &quot;\n&quot;;
	} else {
		warn &quot;error &quot; . $perl_res-&gt;{&#039;responseDetails&#039;} . &quot;\n&quot;;
	}
} else {
	print $response-&gt;status_line . &quot;\n&quot;;
}

sub usage {
	print &quot;usage: &quot;;
	print &quot;\ttranny -f language_code -t language_code [original text]\n\n&quot;;
	print &quot;-f language_code (optional)\n\n&quot;;
	print &quot;-t language_code (optional)\n\n&quot;;
	print &quot;-o original_file (optional)\n\n&quot;;
	print &quot;-h this help\n\n&quot;;
	print &quot;-l language list\n\n&quot;;
	print &quot;Tranny uses Google Translate and requires an Internet connection to work.\n&quot;;
	print &quot;Text is translated from STDIN, from the command line or a file with -o.\n\n&quot;;
	print &quot;By default,the &#039;from&#039; language is automatically detected and translated to English (en).\n\n&quot;;
	if ( defined $opts{l} &amp;&amp; $opts{l} == 1 ) { list_languages() }
	exit;
}

sub list_languages {
	my $num_columns = ceil( $screen_cols / 23 );
	my $num_rows = ceil ( keys(%languages) /$num_columns );
	my $row = 0;
	my $col = 0;
	my @formatted_languages = ( );
	foreach my $key ( sort ( keys(%languages) ) ) {
		$row++;
		$formatted_languages[$col][$row] =  sprintf( &quot;%-14s %-6s&quot;, $key, $languages{$key} );
		if ( $row == $num_rows ){
			$row = 0;
			$col++;
		}
	}
	for ($row = 0; $row &lt;= $num_rows; $row++) {
		for ($col = 0; $col &lt;= $num_columns; $col++) {
			if ( defined $formatted_languages[$col][$row] ){
				print $formatted_languages[$col][$row];
			}
		}
		print &quot;\n&quot;;
	}
}
</pre>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F&amp;title=Linux%20command%20line%20language%20translator&amp;bodytext=I%20wanted%20a%20command%20language%20translator%20that%20can%20be%20used%20in%20bash%20shell%20scripts.%20There%20are%20a%20couple%20of%20options%20available%2C%20but%20none%20that%20were%20versatile%20enough.%20A%20little%20research%20resulted%20in%20finding%20that%20Google%20Translate%20offered%20what%20I%20wanted%20and%20that%20th" title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F&amp;title=Linux%20command%20line%20language%20translator&amp;notes=I%20wanted%20a%20command%20language%20translator%20that%20can%20be%20used%20in%20bash%20shell%20scripts.%20There%20are%20a%20couple%20of%20options%20available%2C%20but%20none%20that%20were%20versatile%20enough.%20A%20little%20research%20resulted%20in%20finding%20that%20Google%20Translate%20offered%20what%20I%20wanted%20and%20that%20th" title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F&amp;t=Linux%20command%20line%20language%20translator" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F&amp;title=Linux%20command%20line%20language%20translator" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F&amp;title=Linux%20command%20line%20language%20translator&amp;annotation=I%20wanted%20a%20command%20language%20translator%20that%20can%20be%20used%20in%20bash%20shell%20scripts.%20There%20are%20a%20couple%20of%20options%20available%2C%20but%20none%20that%20were%20versatile%20enough.%20A%20little%20research%20resulted%20in%20finding%20that%20Google%20Translate%20offered%20what%20I%20wanted%20and%20that%20th" title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Linux%20command%20line%20language%20translator&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F&amp;title=Linux%20command%20line%20language%20translator" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Linux%20command%20line%20language%20translator&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F&amp;title=Linux%20command%20line%20language%20translator" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Linux%20command%20line%20language%20translator%20-%20http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F23%2Flinux-command-line-language-translator%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/wNzZwgUa3HUT1PrrzJbmTgwM6Hs/0/da"><img src="http://feedads.g.doubleclick.net/~a/wNzZwgUa3HUT1PrrzJbmTgwM6Hs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/wNzZwgUa3HUT1PrrzJbmTgwM6Hs/1/da"><img src="http://feedads.g.doubleclick.net/~a/wNzZwgUa3HUT1PrrzJbmTgwM6Hs/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/fViCQDPhjFM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2010/06/23/linux-command-line-language-translator/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2010/06/23/linux-command-line-language-translator/</feedburner:origLink></item>
		<item>
		<title>Bash for the word lover</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/Wq_Xez1LzRw/</link>
		<comments>http://www.andrewault.net/2010/06/10/bash-for-the-word-lover/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 23:54:10 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[unix bash]]></category>
		<category><![CDATA[utiity]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[words]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=626</guid>
		<description><![CDATA[<p>It&#8217;s a WYSIWYG world. After all, we&#8217;re nearly in the future, which I define as 2019, the year Rick Deckard chases down replicants in the Blade Runner. Still no flying cars, which is disappointing. Even so, we have Steve Jobs, so the future coming, right?</p> <p>GUI everything isn&#8217;t all that it could be. For [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a WYSIWYG world. After all, we&#8217;re nearly in the future, which I define as 2019, the year Rick Deckard chases down replicants in the Blade Runner. Still no flying cars, which is disappointing. Even so, we have Steve Jobs, so the future coming, right?</p>
<p>GUI everything isn&#8217;t all that it could be. For many, many tasks, it is more expeditious to open a terminal and get a bash prompt. CLI. Character. Text. It could be green on black, or it would be a rainbow on white, but it is not different from a Televideo terminal, or a Teletype for that matter. As good as the Bourne Again Shell is, it is not graphical or fancy.</p>
<p>What it is is efficient. For a sharp mind and one given to efficiency, the terminal is power. Want to replace frick with frack in 800 HTML files?</p>
<pre class="brush: php">
find ~/web/project3 -name &#039;*.php&#039; | xargs perl -pi -e &#039;s/frick/frack/g&#039;
</pre>
<p><strong>Bam.</strong> Done.</p>
<p>This is why I have 3 terminals open right now. One is connected to a server somewhere in Texas. I just fixed some text on a site with a command much like the one above.</p>
<p>But you already knew all that. You Googled and found this page, so you are already 1337 or whatnot. How about some word power on the command line?</p>
<h3>Install some packages</h3>
<p>This will install the packages we will use on an Ubuntu or Debian system. For other distributions, you will need to use your distributions package system.</p>
<p>To install on Ubuntu or Debian, just install the needed APT packages:</p>
<pre class="brush: php">
sudo aptitude -y install wordnet wamerican-large curl wget an
</pre>
<h3>Definitions</h3>
<p>This grabs a definition for a word from dict.org. For &#8220;unusual&#8221; for example:</p>
<pre class="brush: php">
curl --stderr /dev/null dict://dict.org/d:unusual | sed &#039;/^[.,0-9].*$/d&#039;
</pre>
<p>Which returns:</p>
<p><code>Unusual \Un*u"su*al\, a.<br />
   Not usual; uncommon; rare; as, an unusual season; a person of<br />
   unusual grace or erudition. -- {Un*u"su*al*ly}, adv. --<br />
   {Un*u"su*al*ness}, n.<br />
   [1913 Webster]<br />
</code></p>
<p>As you can see you are using <strong>curl</strong> to request a definition for &#8220;unusual&#8221;, then using <strong>sed</strong> to filter the results, to exclude extra stuff you don&#8217;t want. You could just enter &#8220;curl dict://dict.org/d:unusual&#8221; for the raw deal. Good on ya.</p>
<p>You can turn this into a script:</p>
<pre class="brush: php">
#! /bin/bash
# display definition of a word
#
curl --stderr /dev/null dict://dict.org/d:$1 | sed &#039;/^[.,0-9].*$/d&#039;
</pre>
<p>Save that in a file called &#8220;def&#8221; and run &#8220;chmod +x def&#8221; to make it executable. Then &#8220;def unusual&#8221; will return the same definition. You just created your own tool. You rock.</p>
<h3>Wordnet</h3>
<p>How about more power? Princeton has a project called <a href="http://wordnet.princeton.edu/">Wordnet</a>, which organizes nouns, verbs, adjectives and adverbs into set of &#8220;cognitive synonyms&#8221; and provides tools to use this data. With Wordnet, synonyms, antonyms and other lexical relations can be found for a given word.</p>
<p>To show a definition, (still using &#8220;unusual&#8221; as an example):</p>
<pre class="brush: php">
wn unusual -over
</pre>
<p>Here&#8217;s the output:</p>
<p><code>Overview of adj unusual</p>
<p>The adj unusual has 3 senses (first 3 from tagged texts)</p>
<p>1. (24) unusual -- (not usual or common or ordinary; "a scene of unusual beauty"; "a man of unusual ability"; "cruel and unusual punishment"; "an unusual meteorite")<br />
2. (1) strange, unusual -- (being definitely out of the ordinary and unexpected; slightly odd or even a bit weird; "a strange exaltation that was indefinable"; "a strange fantastical mind"; "what a strange sense of humor she has")<br />
3. (1) unusual -- (not commonly encountered; "two-career families are no longer unusual")<br />
</code></p>
<p>This uses the &#8220;-over&#8221; option. Some other options are:</p>
<table>
<tr>
<td>-synsa</td>
<td>adjective synonyms</td>
</tr>
<tr>
<td>-synsn</td>
<td>noun synonyms</td>
</tr>
<tr>
<td>-synsr</td>
<td>adverb synonyms</td>
</tr>
<tr>
<td>-antsa</td>
<td>adjective antonymns</td>
</tr>
<tr>
<td>-antsn</td>
<td>noun antonymns</td>
</tr>
<tr>
<td>-antsr</td>
<td>adverb antonymns</td>
</tr>
</table>
<p>Wordnet is extensive and there are many more options, run &#8220;man wn&#8221; for more.</p>
<h3>Crossword help</h3>
<p>This is simply a use of <strong>grep</strong> to pattern match words in a word list file.</p>
<p>Use a regular expression to find a word. In quotes, start your pattern with a &#8220;^&#8221; character and end with a &#8220;$&#8221; character. Use a period &#8220;.&#8221; for each unknown character.</p>
<pre class="brush: php">
grep &#039;^.a...f.c.n...$&#039; /usr/share/dict/words
</pre>
<p>Magnificent!</p>
<h3>Rhyming</h3>
<p>This uses the <a href="http://rhyme.sourceforge.net/">rhyme</a> project, which provides a rhyming dictionary for the command line.</p>
<p>To get, build and install <strong>rhyme</strong> on your system:</p>
<pre class="brush: php">
sudo aptitude -y install build-essential libgdbm-dev libreadline-dev
cd ~
DIR=&quot;src&quot; &amp;&amp; [ -d &quot;$DIR&quot; ] || mkdir &quot;$DIR&quot;
cd src
wget http://softlayer.dl.sourceforge.net/project/rhyme/rhyme/0.9/rhyme-0.9.tar.gz
tar -xzf rhyme-0.9.tar.gz
cd rhyme-0.9
make
sudo make install
</pre>
<p>Holy smokes, you just built software! There is no stopping you. To find a rhyme, using &#8220;house&#8221; as an example:</p>
<pre class="brush: php">
rhyme house
</pre>
<p>House rhymes! Lots of them.</p>
<h3>Anagrams</h3>
<p>Anagrams are pretty much pure word fun. It is fun to see what an anagram of your name is.</p>
<p>Print single-word anagrams of &#8220;andrew&#8221;:</p>
<pre class="brush: php">
an -l 1 andrew
</pre>
<p>Just call me the wander warden.</p>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F&amp;title=Bash%20for%20the%20word%20lover&amp;bodytext=It%27s%20a%20WYSIWYG%20world.%20After%20all%2C%20we%27re%20nearly%20in%20the%20future%2C%20which%20I%20define%20as%202019%2C%20the%20year%20Rick%20Deckard%20chases%20down%20replicants%20in%20the%20Blade%20Runner.%20Still%20no%20flying%20cars%2C%20which%20is%20disappointing.%20Even%20so%2C%20we%20have%20Steve%20Jobs%2C%20so%20the%20future%20coming%2C%20ri" title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F&amp;title=Bash%20for%20the%20word%20lover&amp;notes=It%27s%20a%20WYSIWYG%20world.%20After%20all%2C%20we%27re%20nearly%20in%20the%20future%2C%20which%20I%20define%20as%202019%2C%20the%20year%20Rick%20Deckard%20chases%20down%20replicants%20in%20the%20Blade%20Runner.%20Still%20no%20flying%20cars%2C%20which%20is%20disappointing.%20Even%20so%2C%20we%20have%20Steve%20Jobs%2C%20so%20the%20future%20coming%2C%20ri" title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F&amp;t=Bash%20for%20the%20word%20lover" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F&amp;title=Bash%20for%20the%20word%20lover" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F&amp;title=Bash%20for%20the%20word%20lover&amp;annotation=It%27s%20a%20WYSIWYG%20world.%20After%20all%2C%20we%27re%20nearly%20in%20the%20future%2C%20which%20I%20define%20as%202019%2C%20the%20year%20Rick%20Deckard%20chases%20down%20replicants%20in%20the%20Blade%20Runner.%20Still%20no%20flying%20cars%2C%20which%20is%20disappointing.%20Even%20so%2C%20we%20have%20Steve%20Jobs%2C%20so%20the%20future%20coming%2C%20ri" title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Bash%20for%20the%20word%20lover&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F&amp;title=Bash%20for%20the%20word%20lover" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Bash%20for%20the%20word%20lover&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F&amp;title=Bash%20for%20the%20word%20lover" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Bash%20for%20the%20word%20lover%20-%20http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F10%2Fbash-for-the-word-lover%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/z_FgN-s9Wt7sLO_R85ydewnGqb8/0/da"><img src="http://feedads.g.doubleclick.net/~a/z_FgN-s9Wt7sLO_R85ydewnGqb8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/z_FgN-s9Wt7sLO_R85ydewnGqb8/1/da"><img src="http://feedads.g.doubleclick.net/~a/z_FgN-s9Wt7sLO_R85ydewnGqb8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/Wq_Xez1LzRw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2010/06/10/bash-for-the-word-lover/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2010/06/10/bash-for-the-word-lover/</feedburner:origLink></item>
		<item>
		<title>Install Dropbox on Ubuntu Server</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/qMhywEM2wiA/</link>
		<comments>http://www.andrewault.net/2010/06/08/install-dropbox-on-ubuntu-server/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 21:31:38 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[ubuntu server]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=602</guid>
		<description><![CDATA[<p>Dropbox is so useful! Wouldn&#8217;t it be great to have that same convenience and function for your user account on your server, just like you have on your workstation?</p> <p>This has been tested on Ubuntu Lucid and Jaunty. This procedure will create a system with:</p> Install a separate Dropbox client (daemon) for individual users [...]]]></description>
			<content:encoded><![CDATA[<p>Dropbox is so useful! Wouldn&#8217;t it be great to have that same convenience and function for your user account on your server, just like you have on your workstation?</p>
<p>This has been tested on Ubuntu Lucid and Jaunty. This procedure will create a system with:</p>
<ul>
<li>Install a separate Dropbox client (daemon) for individual users</li>
<li>Each user has a separate Dropbox account</li>
<li>All the daemons will be managed together with normal daemon controls</li>
</ul>
<p>This allows individuals to have their own Dropbox accounts, each with a separate process syncing their individual ~/Dropbox directory. With one command an admin can start or stop all the daemons at once.</p>
<h3>Install Prerequisites</h3>
<p>Later, we&#8217;ll need to read a sqlite3 database record, so install sqlite3.</p>
<pre class="brush: bash">
sudo aptitude -y install sqlite3
</pre>
<h3>Install Dropbox client for an individual user</h3>
<p>This step is repeated for each user that wants a Dropbox client. Start by setting up your own account, then repeat for each user. This is run with a user&#8217;s own account. The changes made all take place in their home directory.</p>
<p>First, determine whether you have 32-bit or 64-bit Ubuntu Server. You must install the correct version, either 32 or 64 bit or it will not work. The following command will tell you which is installed:</p>
<pre class="brush: bash">
uname -a | grep &#039;_64&#039; &gt;/dev/null &amp;&amp; echo &#039;A 64-bit OS is installed&#039;; uname -a | grep &#039;_64&#039; &gt;/dev/null || echo &#039;A 32-bit OS is installed&#039;
</pre>
<p>Run the correct installation, based on whether a 32-bit or 64-bit OS is installed.</p>
<p>32-bit installation:</p>
<pre class="brush: bash">
cd ~
wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86
tar -zxof dropbox.tar.gz
</pre>
<p><strong>or</strong></p>
<p>64-bit installation:</p>
<pre class="brush: bash">
cd ~
wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86_64
tar -zxof dropbox.tar.gz
</pre>
<p><strong>Link user&#8217;s Dropbox client to their Dropbox account:</strong></p>
<pre class="brush: bash">
wget http://dl.dropbox.com/u/6995/dbmakefakelib.py
python dbmakefakelib.py
</pre>
<p>The above will <strong>run for a little while without printing anything</strong>, then print “dropboxd ran for 15 seconds without quitting &#8211; success?”. <strong>When it does so, press control-c twice.</strong> Yes, it is unusual. What this does is populate a sqlite3 database with an ID from the Dropbox server. Next, we&#8217;ll extract that code and use it to link your Dropbox user account with this CLI Dropbox client instance.</p>
<h4>On the server, via SSH</h4>
<p>Get the URL with:</p>
<pre class="brush: bash">
echo https://www.dropbox.com/cli_link?host_id=`echo &#039;.dump config&#039; | sqlite3 ~/.dropbox/dropbox.db | grep host_id | cut -d \&#039; -f 4 | python -c &#039;print raw_input().decode(&quot;base64&quot;)&#039; | grep &#039;^V&#039; | cut -b 2-`
</pre>
<h4>On your local machine, in a web browser</h4>
<p>Copy the URL that the above printed and paste it into a web browser. When you do so, Dropbox will register your client on the server with your Dropbox account.</p>
<p>At this point, Dropbox will not be quite working yet. The next steps will take care of that.</p>
<h3>Create Dropbox daemon control</h3>
<p>The next task is to create a system to start and stop the dropbox daemon for each user on the system that has Dropbox installed for his/her user account. The following daemon init script was lifted from: <a href="http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall">http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall</a>.</p>
<p>Of course, this is for the use of the system admin. This creates a normal daemon init start/stop script and installs it so the Dropbox daemons are started when the system boots. The admin can also use this to control the Dropbox daemons manually.
<pre class="brush: bash">
sudo vi /etc/init.d/dropbox
</pre>
<p>Paste in the following code. Then, modify line 3, replacing &#8220;user1 user2&#8243; with your username. For future reference, additional user&#8217;s Dropbox daemons can be controlled with this one script &#8211; add additional username separated with spaces.</p>
<pre class="brush: bash">
# dropbox service
# separate usernames in the following line with spaces.
DROPBOX_USERS=&quot;user1 user2&quot;

DAEMON=.dropbox-dist/dropbox

start() {
    echo &quot;Starting dropbox...&quot;
    for dbuser in $DROPBOX_USERS; do
        HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
        if [ -x $HOMEDIR/$DAEMON ]; then
            HOME=&quot;$HOMEDIR&quot; start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
        fi
    done
}

stop() {
    echo &quot;Stopping dropbox...&quot;
    for dbuser in $DROPBOX_USERS; do
        HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
        if [ -x $HOMEDIR/$DAEMON ]; then
            start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON
        fi
    done
}

status() {
    for dbuser in $DROPBOX_USERS; do
        dbpid=`pgrep -u $dbuser dropbox`
        if [ -z $dbpid ] ; then
            echo &quot;dropboxd for USER $dbuser: not running.&quot;
        else
            echo &quot;dropboxd for USER $dbuser: running (pid $dbpid)&quot;
        fi
    done
}

case &quot;$1&quot; in
  start)
    start
    ;;

  stop)
    stop
    ;;

  restart|reload|force-reload)
    stop
    start
    ;;

  status)
    status
    ;;

  *)
    echo &quot;Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}&quot;
    exit 1

esac

exit 0
</pre>
<p>Make the init script executable and restart the daemon:</p>
<pre class="brush: bash">
sudo chmod +x /etc/init.d/dropbox
sudo /etc/init.d/dropbox restart
</pre>
<p>When you restart the daemon, it will be running correctly linked to your Dropbox account. It will create a Dropbox directory in your home directory and will start to populate it with files you have on Dropbox.</p>
<p>Have the daemon(s) run automatically at boot time:</p>
<pre class="brush: bash">
sudo update-rc.d dropbox defaults
</pre>
<p>The above correctly copies links as needed so the daemon(s) start when the server boots.</p>
<h3>Managing the Daemons</h3>
<p>A separate daemon will be run for each user that has the Dropbox client installed &#8211; with only one command. This makes it easy for individual users to have separate Dropbox accounts, each syncing to ~/Dropbox for their user account. Here are the commands to manage these daemons:</p>
<p><strong>Start</strong> Dropbox services for all users:</p>
<pre class="brush: bash">
sudo /etc/init.d/dropbox start
</pre>
<p><strong>Stop</strong> Dropbox services for all users:</p>
<pre class="brush: bash">
sudo /etc/init.d/dropbox stop
</pre>
<p><strong>Restart</strong> Dropbox services for all users:</p>
<pre class="brush: bash">
sudo /etc/init.d/dropbox restart
</pre>
<p>Get <strong>service status</strong> for each user Dropbox service:</p>
<pre class="brush: bash">
sudo /etc/init.d/dropbox status
</pre>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F&amp;title=Install%20Dropbox%20on%20Ubuntu%20Server&amp;bodytext=Dropbox%20is%20so%20useful%21%20Wouldn%27t%20it%20be%20great%20to%20have%20that%20same%20convenience%20and%20function%20for%20your%20user%20account%20on%20your%20server%2C%20just%20like%20you%20have%20on%20your%20workstation%3F%0D%0A%0D%0AThis%20has%20been%20tested%20on%20Ubuntu%20Lucid%20and%20Jaunty.%20This%20procedure%20will%20create%20a%20syste" title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F&amp;title=Install%20Dropbox%20on%20Ubuntu%20Server&amp;notes=Dropbox%20is%20so%20useful%21%20Wouldn%27t%20it%20be%20great%20to%20have%20that%20same%20convenience%20and%20function%20for%20your%20user%20account%20on%20your%20server%2C%20just%20like%20you%20have%20on%20your%20workstation%3F%0D%0A%0D%0AThis%20has%20been%20tested%20on%20Ubuntu%20Lucid%20and%20Jaunty.%20This%20procedure%20will%20create%20a%20syste" title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F&amp;t=Install%20Dropbox%20on%20Ubuntu%20Server" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F&amp;title=Install%20Dropbox%20on%20Ubuntu%20Server" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F&amp;title=Install%20Dropbox%20on%20Ubuntu%20Server&amp;annotation=Dropbox%20is%20so%20useful%21%20Wouldn%27t%20it%20be%20great%20to%20have%20that%20same%20convenience%20and%20function%20for%20your%20user%20account%20on%20your%20server%2C%20just%20like%20you%20have%20on%20your%20workstation%3F%0D%0A%0D%0AThis%20has%20been%20tested%20on%20Ubuntu%20Lucid%20and%20Jaunty.%20This%20procedure%20will%20create%20a%20syste" title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Install%20Dropbox%20on%20Ubuntu%20Server&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F&amp;title=Install%20Dropbox%20on%20Ubuntu%20Server" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Install%20Dropbox%20on%20Ubuntu%20Server&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F&amp;title=Install%20Dropbox%20on%20Ubuntu%20Server" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Install%20Dropbox%20on%20Ubuntu%20Server%20-%20http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F08%2Finstall-dropbox-on-ubuntu-server%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/vGTNscEoCXRAjY29tui6NAOJTZw/0/da"><img src="http://feedads.g.doubleclick.net/~a/vGTNscEoCXRAjY29tui6NAOJTZw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/vGTNscEoCXRAjY29tui6NAOJTZw/1/da"><img src="http://feedads.g.doubleclick.net/~a/vGTNscEoCXRAjY29tui6NAOJTZw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/qMhywEM2wiA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2010/06/08/install-dropbox-on-ubuntu-server/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2010/06/08/install-dropbox-on-ubuntu-server/</feedburner:origLink></item>
		<item>
		<title>Script to create a Kohana instance</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/YuLDW3UQBo0/</link>
		<comments>http://www.andrewault.net/2010/06/07/script-to-create-a-kohana-instance/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 23:07:00 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[kohana]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=597</guid>
		<description><![CDATA[<p>This is a copy of the script I use to create an instance of a Kohana project. It works on Ubuntu server (tested with Lucid). Adapt it to your own needs, of course.</p> #! /bin/bash CODE=&#34;upc&#34; OWNER=&#34;myusername&#34; GROUP=&#34;mygroupname&#34; KOHANA_URL=&#34;http://dev.kohanaframework.org/attachments/download/1355/kohana-v2.3.4.zip&#34; KOHANA_ZIP=&#34;kohana-v2.3.4.zip&#34; SITESROOT=&#34;/usr/local/var/www&#34; URL=&#34;www.mysite.com&#34; # database.php parameters DBUSER=&#34;mydbuser&#34; DBPWD=&#34;mydbpasswd&#34; DBHOST=&#34;localhost&#34; DBDATABASE=&#34;mydbname&#34; # # make sure this [...]]]></description>
			<content:encoded><![CDATA[<p>This is a copy of the script I use to create an instance of a Kohana project. It works on Ubuntu server (tested with Lucid). Adapt it to your own needs, of course.</p>
<pre class="brush: bash">
#! /bin/bash

CODE=&quot;upc&quot;
OWNER=&quot;myusername&quot;
GROUP=&quot;mygroupname&quot;
KOHANA_URL=&quot;http://dev.kohanaframework.org/attachments/download/1355/kohana-v2.3.4.zip&quot;
KOHANA_ZIP=&quot;kohana-v2.3.4.zip&quot;
SITESROOT=&quot;/usr/local/var/www&quot;
URL=&quot;www.mysite.com&quot;
# database.php parameters
DBUSER=&quot;mydbuser&quot;
DBPWD=&quot;mydbpasswd&quot;
DBHOST=&quot;localhost&quot;
DBDATABASE=&quot;mydbname&quot;

#
# make sure this is run as root
#
if [[ $UID -ne 0 ]]; then
    echo &quot;Not running as root&quot;
    exit
fi

if [ ! -d $SITESROOT ]; then
	echo &quot;$SITESROOT directory does not exist&quot;
	exit
fi

#
# change to the siteroot directory
#
cd $SITESROOT

if [ -d $URL ]; then
	echo &quot;$SITESROOT/$URL directory already exists&quot;
	exit
fi 

mkdir $URL
chown $OWNER:$GROUP $URL
cd $URL

#
# create kohana directory
#
echo creating kohana directory
mkdir kohana
chown $OWNER:$GROUP kohana
chmod g+ws kohana
wget &quot;$KOHANA_URL&quot;
unzip &quot;$KOHANA_ZIP&quot;
rm &quot;$KOHANA_ZIP&quot;
chown -R $OWNER:$GROUP kohana
chmod -R g+w kohana
chown $OWNER:www-data kohana/application/logs
rm kohana/example.htaccess
rm kohana/install.php
rm kohana/Kohana\ License.html
rm kohana/kohana.png

#
# create public directory
#
echo creating public directory
mkdir public
chown $OWNER:$GROUP public
chmod g+ws public
mv kohana/index.php public/
sed -i &quot;s\\kohana_application =.*$\\kohana_application = &#039;../kohana/application&#039;;\\&quot; public/index.php
sed -i &quot;s\\kohana_modules =.*$\\kohana_modules = &#039;../kohana/modules&#039;;\\&quot; public/index.php
sed -i &quot;s\\kohana_system =.*$\\kohana_system = &#039;../kohana/system&#039;;\\&quot; public/index.php
echo &quot;# turn on URL rewriting
RewriteEngine On
RewriteBase /
&quot; &gt; public/.htaccess

#
# create Apache logs directory
#
echo creating logs directory
mkdir logs
chown $OWNER:www-data logs
chmod g+ws logs
touch logs/error.log
touch logs/combined.log

#
# create utilties directory
#
echo creating utilties directory
mkdir utilities
chown $OWNER:$GROUP utilities
chmod g+ws utilities

#
# modify kohana/application/config/config.php
#
echo modifying kohana/application/config/config.php
sed -i &quot;s\\&#039;/kohana/&#039;\\&#039;$URL/&#039;\\&quot; kohana/application/config/config.php

#
# create kohana/application/config/database.php
#
echo creating kohana/application/config/database.php
cp kohana/system/config/database.php kohana/application/config/database.php
chown $OWNER:$GROUP kohana/application/config/database.php
chmod g+w kohana/application/config/database.php
sed -i &quot;s\\&#039;user&#039;.*$\\&#039;user&#039;     =&gt; &#039;$DBUSER&#039;,\\&quot; kohana/application/config/database.php
sed -i &quot;s\\&#039;pass&#039;.*$\\&#039;pass&#039;     =&gt; &#039;$DBPWD&#039;,\\&quot; kohana/application/config/database.php
sed -i &quot;s\\&#039;host&#039;.*$\\&#039;host&#039;     =&gt; &#039;$DBHOST&#039;,\\&quot; kohana/application/config/database.php
sed -i &quot;s\\&#039;database&#039;.*$\\&#039;database&#039; =&gt; &#039;$DBDATABASE&#039;,\\&quot; kohana/application/config/database.php

#
# create kohana/application/config/routes.php
#
echo creating kohana/application/config/routes.php
cp kohana/system/config/routes.php kohana/application/config/routes.php
chown $OWNER:$GROUP kohana/application/config/routes.php
chmod g+w kohana/application/config/routes.php
sed -i &quot;s\\&#039;welcome&#039;\\&#039;/index&#039;\\&quot; kohana/application/config/routes.php

#
# copy kohana/application/config/profiler.php
#
echo creating kohana/application/config/profiler.php
cp kohana/system/config/profiler.php kohana/application/config/profiler.php
chown $OWNER:$GROUP kohana/application/config/profiler.php
chmod g+w kohana/application/config/profiler.php

#
# create Apache virtual site
#
echo creating Apache virtual site file in /etc/apache2/sites-available
echo &quot;&lt;VirtualHost *:80&gt;
	ServerName $URL
	DocumentRoot $SITESROOT/$URL/public
	DirectoryIndex index.php
	LogLevel warn
	ErrorLog $SITESROOT/$URL/logs/error.log
	CustomLog $SITESROOT/$URL/logs/combined.log combined
&lt;/VirtualHost&gt;
&quot; &gt; /etc/apache2/sites-available/$URL

#
# finish up
#
echo &quot;enable site with: sudo a2ensite $URL&quot;
echo &quot;restart Apache with: sudo /etc/init.d/apache2 restart&quot;
</pre>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F&amp;title=Script%20to%20create%20a%20Kohana%20instance&amp;bodytext=This%20is%20a%20copy%20of%20the%20script%20I%20use%20to%20create%20an%20instance%20of%20a%20Kohana%20project.%20It%20works%20on%20Ubuntu%20server%20%28tested%20with%20Lucid%29.%20Adapt%20it%20to%20your%20own%20needs%2C%20of%20course.%0D%0A%0D%0A%5Bsourcecode%20language%3D%22bash%22%5D%0D%0A%23%21%20%2Fbin%2Fbash%0D%0A%20%0D%0ACODE%3D%22upc%22%0D%0AOWNER%3D%22myusername%22%0D%0AGROU" title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F&amp;title=Script%20to%20create%20a%20Kohana%20instance&amp;notes=This%20is%20a%20copy%20of%20the%20script%20I%20use%20to%20create%20an%20instance%20of%20a%20Kohana%20project.%20It%20works%20on%20Ubuntu%20server%20%28tested%20with%20Lucid%29.%20Adapt%20it%20to%20your%20own%20needs%2C%20of%20course.%0D%0A%0D%0A%5Bsourcecode%20language%3D%22bash%22%5D%0D%0A%23%21%20%2Fbin%2Fbash%0D%0A%20%0D%0ACODE%3D%22upc%22%0D%0AOWNER%3D%22myusername%22%0D%0AGROU" title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F&amp;t=Script%20to%20create%20a%20Kohana%20instance" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F&amp;title=Script%20to%20create%20a%20Kohana%20instance" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F&amp;title=Script%20to%20create%20a%20Kohana%20instance&amp;annotation=This%20is%20a%20copy%20of%20the%20script%20I%20use%20to%20create%20an%20instance%20of%20a%20Kohana%20project.%20It%20works%20on%20Ubuntu%20server%20%28tested%20with%20Lucid%29.%20Adapt%20it%20to%20your%20own%20needs%2C%20of%20course.%0D%0A%0D%0A%5Bsourcecode%20language%3D%22bash%22%5D%0D%0A%23%21%20%2Fbin%2Fbash%0D%0A%20%0D%0ACODE%3D%22upc%22%0D%0AOWNER%3D%22myusername%22%0D%0AGROU" title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Script%20to%20create%20a%20Kohana%20instance&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F&amp;title=Script%20to%20create%20a%20Kohana%20instance" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Script%20to%20create%20a%20Kohana%20instance&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F&amp;title=Script%20to%20create%20a%20Kohana%20instance" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Script%20to%20create%20a%20Kohana%20instance%20-%20http%3A%2F%2Fwww.andrewault.net%2F2010%2F06%2F07%2Fscript-to-create-a-kohana-instance%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/QrDgYrRRWzWo-qj9pvSvYnLWGIc/0/da"><img src="http://feedads.g.doubleclick.net/~a/QrDgYrRRWzWo-qj9pvSvYnLWGIc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QrDgYrRRWzWo-qj9pvSvYnLWGIc/1/da"><img src="http://feedads.g.doubleclick.net/~a/QrDgYrRRWzWo-qj9pvSvYnLWGIc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/YuLDW3UQBo0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2010/06/07/script-to-create-a-kohana-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2010/06/07/script-to-create-a-kohana-instance/</feedburner:origLink></item>
		<item>
		<title>Creating a Perl Daemon in Ubuntu</title>
		<link>http://feedproxy.google.com/~r/andrewault/~3/4HmhhDq57FY/</link>
		<comments>http://www.andrewault.net/2010/05/27/creating-a-perl-daemon-in-ubuntu/#comments</comments>
		<pubDate>Thu, 27 May 2010 19:20:58 +0000</pubDate>
		<dc:creator>Andrew Ault</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.andrewault.net/?p=557</guid>
		<description><![CDATA[You can create your own daemon in Perl to do whatever is needed. [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a process that need to run in the background, creating a daemon is the key. Some examples of what your can do:</p>
<ul>
<li>Wait for video files to be dropped via FTP and then process them</li>
<li>Check for a recurring problem and report it to admin</li>
<li>Monitor system load and report to the admin at a certain threshold</li>
</ul>
<p>In this post we&#8217;ll take a look at how to create a Perl daemon script and how to get it to run as a daemon whenever the system is started. For the Perl script, a template will be created and for control of the daemon process, standard Debian facilities will be used.</p>
<p>What will be covered:</p>
<ul>
<li>Create the start/stop script in /etc/init.d</li>
<li>Create the Perl daemon script in /usr/bin/</li>
<li>Create the log file in /var/log/</li>
<li>Get the daemon to start automatically when the system boots</li>
<li>How to manage your daemon</li>
</ul>
<p>The <strong>start/stop script</strong> starts and stops the daemon. It is also used by the system to start your daemon when the system starts.</p>
<p>The Perl daemon script contains your custom Perl code to run in the background. It executes your code every x number of seconds.</p>
</p>
<h4>Create the Start/stop Script</h4>
<p>Happily, Debian and therefore Ubuntu, supplies a template that uses the Debian start-stop-daemon command to start and stop daemons. It is only necessary to copy this template to a new file of the correct name and modify it for the purpose.</p>
<p>These scripts reside in the /etc/init.d/ directory. The script you create will have the exact same filename as the Perl daemon script you will create and the name cannot have a file extension &#8211; just the bare name.</p>
<p><p>Substitute your daemon&#8217;s name for &#8220;mydaemon&#8221; in the examples.</p>
<pre class="brush: bash">
sudo cp /etc/init.d/skeleton /etc/init.d/mydaemon
sudo chmod +x /etc/init.d/mydaemon
</pre>
<pre class="brush: bash">
sudo vi /etc/init.d/mydaemon
</pre>
<p>Make changes to your start/stop script. Locate the header in the script:</p>
<pre class="brush: bash">
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=&quot;Description of the service&quot;
NAME=daemonexecutablename
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=&quot;--options args&quot;
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
</pre>
<li>Change the content of DESC to a meaningful description of your daemon.</li>
<li>Change the content for NAME to the exact name of your daemon.</li>
<h4>Create the Perl Daemon Script</h4>
<p>Use the Perl Daemon Script Template located at the end of this post. In the following, the script template is copied to /usr/bin/where executables specific to this system are located. Actually, you would copy the template to your home directory, make the changes and then copy the daemon script to /usr/bin/.</p>
<pre class="brush: bash">
sudo cp daemon_template.pl /usr/bin/mydaemon
sudo vi /usr/bin/mydaemon
sudo chmod +x /usr/bin/mydaemon
</pre>
<p>The script template is commented with the changes that are needed. In particular, change the value of <strong>$daemonName</strong> to the exact name of your new daemon. Ten, add your custom code where <strong># do something</strong> appears.</p>
<h3>Prerequisites</h3>
<p>The script uses File::Pid and POSIX from CPAN, so you&#8217;ll need to install that module:</p>
<pre class="brush: bash">
sudo aptitude install cpan
sudo cpan POSIX
sudo cpan File::Pid
</pre>
<h4>Create the Log File</h4>
<p>We&#8217;ll create the log file so it has the correct ownership and permissions. The log fie has the daemon name appended with &#8220;.log&#8221;. It is located in the /var/log/ directory.</p>
<pre class="brush: bash">
sudo touch /var/log/mydaemon.log
sudo chmod 640 /var/log/mydaemon.log
sudo chown root:adm /var/log/mydaemon.log
</pre>
<p>The permissions and ownership change allow adm group members to read the log, per convention. Add yourself to adm group to view logs.</p>
<h4>Run your Daemon</h4>
<p>As you have created a standard start/stop script for your daemon, you can start it the standard way:</p>
<pre class="brush: bash">
sudo /etc/init.d/mydaemon start
</pre>
<h4>Stop your Daemon</h4>
<p>Similarly, your daemon is easy to stop and restart:</p>
<pre class="brush: bash">
sudo /etc/init.d/mydaemon stop
</pre>
<pre class="brush: bash">
sudo /etc/init.d/mydaemon restart
</pre>
<h4> Automatically Start your Daemon</h4>
<p>This command tells your system to start your daemon automatically when the system starts:</p>
<pre class="brush: bash">
update-rc.d mydaemon defaults 99
</pre>
<p>To keep your daemon from starting, if needed:</p>
<pre class="brush: bash">
update-rc.d -f mydaemon remove
</pre>
<h3>Managing Daemons</h3>
<h4>List running daemons</h4>
<p>Well-behaved daemons generally create a PID file in /var/run/. List that directory and your have a fair list of running daemons.</p>
<pre class="brush: bash">
sudo ls /var/run/
</pre>
<h4>Get PID for a particular daemon</h4>
<p>If you know the name of a daemon and want to see if it is running and get its PID, use pgrep.</p>
<pre class="brush: bash">
pgrep mydaemon
</pre>
<p>Also useful is the ps command, which list processes.</p>
<pre class="brush: bash">
ps aux
</pre>
<p> The aux switch limits output to processes not associated with a terminal. </p>
<h4>Show programs running as daemons</h4>
<p>This line attempts to show programs that are running as daemons.</p>
<pre class="brush: bash">
which `ps aux | cut -c 66- | cut -d\  -f 1` | sort | uniq
</pre>
<h3>The Perl Daemon Script Template</h3>
<pre class="brush: perl">
#!/usr/bin/perl -w
#
# mydaemon.pl by Andrew Ault, www.andrewault.net
#
# Free software. Use this as you wish.
#
# Throughout this template &quot;mydaemon&quot; is used where the name of your daemon should
# be, replace occurrences of &quot;mydaemon&quot; with the name of your daemon.
#
# This name will also be the exact name to give this file (WITHOUT a &quot;.pl&quot; extension).
#
# It is also the exact name to give the start-stop script that will go into the
# /etc/init.d/ directory.
#
# It is also the name of the log file in the /var/log/ directory WITH a &quot;.log&quot;
# file extension.
#
# Replace &quot;# do something&quot; with your super useful code.
#
# Use &quot;# logEntry(&quot;log something&quot;);&quot; to log whatever your need to see in the log.
#
use strict;
use warnings;
use POSIX;
use File::Pid;

# make &quot;mydaemon.log&quot; file in /var/log/ with &quot;chown root:adm mydaemon&quot;

# TODO: change &quot;mydaemon&quot; to the exact name of your daemon.
my $daemonName    = &quot;mydaemon&quot;;
#
my $dieNow        = 0;                                     # used for &quot;infinte loop&quot; construct - allows daemon mode to gracefully exit
my $sleepMainLoop = 120;                                    # number of seconds to wait between &quot;do something&quot; execution after queue is clear
my $logging       = 1;                                     # 1= logging is on
my $logFilePath   = &quot;/var/log/&quot;;                           # log file path
my $logFile       = $logFilePath . $daemonName . &quot;.log&quot;;
my $pidFilePath   = &quot;/var/run/&quot;;                           # PID file path
my $pidFile       = $pidFilePath . $daemonName . &quot;.pid&quot;;

# daemonize
use POSIX qw(setsid);
chdir &#039;/&#039;;
umask 0;
open STDIN,  &#039;/dev/null&#039;   or die &quot;Can&#039;t read /dev/null: $!&quot;;
open STDOUT, &#039;&gt;&gt;/dev/null&#039; or die &quot;Can&#039;t write to /dev/null: $!&quot;;
open STDERR, &#039;&gt;&gt;/dev/null&#039; or die &quot;Can&#039;t write to /dev/null: $!&quot;;
defined( my $pid = fork ) or die &quot;Can&#039;t fork: $!&quot;;
exit if $pid;

# dissociate this process from the controlling terminal that started it and stop being part
# of whatever process group this process was a part of.
POSIX::setsid() or die &quot;Can&#039;t start a new session.&quot;;

# callback signal handler for signals.
$SIG{INT} = $SIG{TERM} = $SIG{HUP} = \&amp;signalHandler;
$SIG{PIPE} = &#039;ignore&#039;;

# create pid file in /var/run/
my $pidfile = File::Pid-&gt;new( { file =&gt; $pidFile, } );

$pidfile-&gt;write or die &quot;Can&#039;t write PID file, /dev/null: $!&quot;;

# turn on logging
if ($logging) {
	open LOG, &quot;&gt;&gt;$logFile&quot;;
	select((select(LOG), $|=1)[0]); # make the log file &quot;hot&quot; - turn off buffering
}

# &quot;infinite&quot; loop where some useful process happens
until ($dieNow) {
	sleep($sleepMainLoop);

	# TODO: put your custom code here!
	# do something

	# logEntry(&quot;log something&quot;); # use this to log whatever you need to
}

# add a line to the log file
sub logEntry {
	my ($logText) = @_;
	my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
	my $dateTime = sprintf &quot;%4d-%02d-%02d %02d:%02d:%02d&quot;, $year + 1900, $mon + 1, $mday, $hour, $min, $sec;
	if ($logging) {
		print LOG &quot;$dateTime $logText\n&quot;;
	}
}

# catch signals and end the program if one is caught.
sub signalHandler {
	$dieNow = 1;    # this will cause the &quot;infinite loop&quot; to exit
}

# do this stuff when exit() is called.
END {
	if ($logging) { close LOG }
	$pidfile-&gt;remove if defined $pidfile;
}
</pre>
<p>UPDATE:</p>
<p>Looks like there&#8217;s a page in French about this post: <a href="http://www.duncane.net/2011/02/25/perl-daemon/">http://www.duncane.net/2011/02/25/perl-daemon/</a>. Merci Duncane!</p>



share and enjoy:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F&amp;partner=sociable" title="Print"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F&amp;title=Creating%20a%20Perl%20Daemon%20in%20Ubuntu&amp;bodytext=You%20can%20create%20your%20own%20daemon%20in%20Perl%20to%20do%20whatever%20is%20needed." title="Digg"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F" title="Sphinn"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F&amp;title=Creating%20a%20Perl%20Daemon%20in%20Ubuntu&amp;notes=You%20can%20create%20your%20own%20daemon%20in%20Perl%20to%20do%20whatever%20is%20needed." title="del.icio.us"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F&amp;t=Creating%20a%20Perl%20Daemon%20in%20Ubuntu" title="Facebook"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F&amp;title=Creating%20a%20Perl%20Daemon%20in%20Ubuntu" title="Mixx"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F&amp;title=Creating%20a%20Perl%20Daemon%20in%20Ubuntu&amp;annotation=You%20can%20create%20your%20own%20daemon%20in%20Perl%20to%20do%20whatever%20is%20needed." title="Google Bookmarks"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a  href="http://blogplay.com" title="Blogplay"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Creating%20a%20Perl%20Daemon%20in%20Ubuntu&amp;u=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F" title="Fark"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F&amp;title=Creating%20a%20Perl%20Daemon%20in%20Ubuntu" title="Reddit"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Creating%20a%20Perl%20Daemon%20in%20Ubuntu&amp;url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F" title="Slashdot"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F&amp;title=Creating%20a%20Perl%20Daemon%20in%20Ubuntu" title="StumbleUpon"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Creating%20a%20Perl%20Daemon%20in%20Ubuntu%20-%20http%3A%2F%2Fwww.andrewault.net%2F2010%2F05%2F27%2Fcreating-a-perl-daemon-in-ubuntu%2F" title="Twitter"><img src="http://www.andrewault.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>
<p><a href="http://feedads.g.doubleclick.net/~a/01rPkXklcKI3C7ALvXTgsUVU76o/0/da"><img src="http://feedads.g.doubleclick.net/~a/01rPkXklcKI3C7ALvXTgsUVU76o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/01rPkXklcKI3C7ALvXTgsUVU76o/1/da"><img src="http://feedads.g.doubleclick.net/~a/01rPkXklcKI3C7ALvXTgsUVU76o/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/andrewault/~4/4HmhhDq57FY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.andrewault.net/2010/05/27/creating-a-perl-daemon-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		<feedburner:origLink>http://www.andrewault.net/2010/05/27/creating-a-perl-daemon-in-ubuntu/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 1.951 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-03-22 08:09:58 -->

