<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>crunchlife: Samba Network Shares with Nautilus in Hardy Heron Part 2</title>
    <link>http://crunchlife.com/articles/2008/06/01/samba-network-shares-with-nautilus-in-hardy-heron-part-2</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Samba Network Shares with Nautilus in Hardy Heron Part 2</title>
      <description>&lt;p&gt;&lt;img src="/files/ubuntu_logo.png" class="right"&gt;Nearly a month ago I wrote about my &lt;a href="http://crunchlife.com/articles/2008/04/28/samba-network-shares-with-nautilus-in-hardy-heron" target="_blank"&gt;problems connecting to the network shares&lt;/a&gt; of my &lt;a href="http://crunchlife.com/articles/2007/08/03/review-linksys-nas200" target="_blank"&gt;Linksys NAS200&lt;/a&gt; using Nautilus in Ubuntu, Hardy Heron. My fix was simple and it worked. Unfortunately, the solution&amp;#8217;s &lt;a href="http://en.wikipedia.org/wiki/Woman_acceptance_factor" target="_blank"&gt;WAF (Wife Acceptance Factor)&lt;/a&gt; was low. Apparently she didn&amp;#8217;t think it was easy enough to execute smbmount from a Terminal window. Whatever :) I have since written a small shell script that is called from Session Startup.&lt;/p&gt;

&lt;p&gt;Initially, the script failed to connect to my network shares because my wireless network connection hadn&amp;#8217;t finished negotiating before the script was executed. I coded around this by creating a while loop that &lt;a href="http://en.wikipedia.org/wiki/Grep#Usage_as_a_conversational_verb" target="_blank"&gt;greps&lt;/a&gt; the output of a ping to my router. If successful, the mount_shares function is called. Otherwise. the thread will sleep for 10 seconds and try again.&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;#!/bin/bash

user=&amp;quot;thorbardin/ryan%password&amp;quot;
root_dir=&amp;quot;/home/ryan/Network Shares&amp;quot;

mount_shares() {
  public_dir=&amp;quot;$root_dir&amp;quot;/&amp;quot;Public on Thorbardin&amp;quot;
  home_dir=&amp;quot;$root_dir&amp;quot;/&amp;quot;Home on Thorbardin&amp;quot;

  [ -d &amp;quot;$public_dir&amp;quot; ] || mkdir -p &amp;quot;$public_dir&amp;quot;
  [ -d &amp;quot;$home_dir&amp;quot; ] || mkdir -p &amp;quot;$home_dir&amp;quot;

  smbmount &amp;quot;//192.168.1.105/public disk&amp;quot; &amp;quot;$public_dir&amp;quot; -o user=&amp;quot;$user&amp;quot;
  smbmount &amp;quot;//192.168.1.105/ryan&amp;quot; &amp;quot;$home_dir&amp;quot; -o user=&amp;quot;$user&amp;quot;
}

while [ 1 ]; do
  if ping -c2 192.168.1.1 2&amp;gt;&amp;amp;1 | grep ttl; then
    mount_shares

    exit 0   
  fi
  sleep 10
done

exit 0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I&amp;#8217;m already thinking about rewriting this script so that it scans my network using &lt;a href="http://www.menet.umn.edu/docs/software/samba/3.0.14a/help/smbtree.1.html" target="_blank"&gt;smbtree&lt;/a&gt; and automatically mounts all available network shares. That&amp;#8217;ll be Part 3!&lt;/p&gt;</description>
      <pubDate>Sun, 01 Jun 2008 16:07:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:d387ed9b-c3b3-469c-8052-8514021774bc</guid>
      <author>Ryan Baxter</author>
      <link>http://crunchlife.com/articles/2008/06/01/samba-network-shares-with-nautilus-in-hardy-heron-part-2</link>
      <category>Code Snippets</category>
      <category>NAS</category>
      <category>Ubuntu</category>
      <category>Oops</category>
      <category>Bash</category>
      <trackback:ping>http://crunchlife.com/articles/trackback/67</trackback:ping>
    </item>
    <item>
      <title>"Samba Network Shares with Nautilus in Hardy Heron Part 2" by Glenn</title>
      <description>So far I like it.  It was quite easy to get the device up and running. I'm slowly but surely copying my audio and video files to it.  I also enabled the media server so I can access the files from my PS3.</description>
      <pubDate>Thu, 12 Jun 2008 18:12:44 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:3d0e548a-2dc8-4b0a-b888-2885523d0521</guid>
      <link>http://crunchlife.com/articles/2008/06/01/samba-network-shares-with-nautilus-in-hardy-heron-part-2#comment-4099</link>
    </item>
    <item>
      <title>"Samba Network Shares with Nautilus in Hardy Heron Part 2" by Ryan Baxter</title>
      <description>Excellent! How do you like the NAS200 so far?</description>
      <pubDate>Tue, 10 Jun 2008 17:29:47 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:a5aa46c7-b0fd-4c96-a39f-c4becc1c7803</guid>
      <link>http://crunchlife.com/articles/2008/06/01/samba-network-shares-with-nautilus-in-hardy-heron-part-2#comment-4096</link>
    </item>
    <item>
      <title>"Samba Network Shares with Nautilus in Hardy Heron Part 2" by Glenn</title>
      <description>Thanks for posting this (and part 1).  I just bought a NAS200, and this information has been very beneficial.</description>
      <pubDate>Tue, 10 Jun 2008 17:27:14 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:bc39f04a-becb-4d69-a282-d6512b42b6b4</guid>
      <link>http://crunchlife.com/articles/2008/06/01/samba-network-shares-with-nautilus-in-hardy-heron-part-2#comment-4095</link>
    </item>
  </channel>
</rss>
