ewreck wrote: 
> Hi there
> 
> I have a similar problem. Instead of a second hard disk i have a NAS in
> my network. I can acces the NAS and go to my multimedia map when i go to
> network and make a connection. But the webbrowser from squeezsebox
> server does not see the NAS. I can't navigate to the multimedia map from
> within the browser.
> I have been reading this thread and regonized the problem. But because i
> am an ubuntu newbie there is a lot information that i don't yet
> understand. Can somebody guide me in what to do?
Without knowing more about your setup, a complete guide is a little hard
to offer up.  But here are some pointers that ought to get you started. 
Because my SBS/LMS/UEML boxes are "headless" (no monitor, keyboard or
mouse attached and thus, running the "server" version of Ubuntu in text
mode with no GUI) I tend to use very simple command-line based
configuration tools.  There may be fancier packages that can
semi-automate this process and perhaps someone with experience with
those can chime in and offer advice.

In terms of getting your Ubuntu box to mount a share from a NAS at boot
time, how you'll do this depends on how the NAS is sharing your media
files.  Is it via NFS?  CIFS?  Offhand, there are a couple of approaches
and one or the other may be a better fit for you.  You can mount the NFS
or CIFS "remote" share in your ubuntu /etc/fstab file.  Google "ubuntu
mount nfs cifs fstab" to find recipes.  But here's a page that can get
you started:

http://www.ubuntugeek.com/mount-network-file-systems-nfssamba-in-ubuntu.html

Caveat: The problem with this approach is that fstab is pretty
unforgiving.  I.e., if your Ubuntu box is a headless server like mine
with no monitor & keyboard attached, you can easily get yourself into a
position where the Ubuntu box won't finish booting because of a fstab
entry.  Your only recourse in this situation is to then attach a monitor
and keyboard in order to force the boot-up to continue and then fix the
offending fstab entry.  If your box isn't headless, then this isn't a
concern.  But if your NAS isn't guaranteed to be on/awake/available when
your Ubuntu box boots up, then this approach can be problematic.

Another approach might be to add entries to your /etc/rc.local file that
would test to see if the NAS was available on the network, wake it if
it's not and then execute the proper mount command once it is.  This is
scripting and, as a self-declared Ubuntu newbie, you should know that
this is the way an awful lot of useful work ends up getting done. 
Learning a little about writing and executing scripts is a good thing. 
/etc/rc.local is itself a script and any instructions encoded there in
get executed every time your Ubuntu box boots up.   So, using this
approach, here's a script that could be called from rc.local:

mount-nas.sh

Code:
--------------------
    
  #!/bin/sh
  
  # NAS details
  NAS_IP=192.168.0.4
  NAS_MAC=aa:bb:cc:dd:ee:ff
  NAS_SHARE='Music'
  
  MOUNT_NAME='/mnt/NAS'
  ISAWAKE=0
  
  
  wake_nas(){
  
        ping -c 1 $NAS_IP >/dev/null 2>&1
        
        if [ $? -gt 0 ]; then
                echo "${NAS_IP} does not respond to ping, attempting to wake it 
up.."
                etherwake -b $NAS_MAC
                sleep 10
                return 0
        fi
        
        return 1
  }
  
  
  
  mount_nas(){
        if [ ! -d "$MOUNT_NAME" ]; then
                mkdir -p "$MOUNT_NAME"
        fi
  
        umount -f "$MOUNT_NAME" >/dev/null 2>&1
        
        mount -t cifs -o guest "//${NAS_IP}/${NAS_SHARE}" "$MOUNT_NAME"
  }
  
  
  #####################################################
  # main()
  #####################################################
  
  if [ ! -z "$1" ]; then
        NAS_IP="$1"
  fi
  
  if [ ! -z "$2" ]; then
        NAS_MAC="$2"
  fi
  
  # Try to wake the NAS max 5 times
  REPCOUNT=5
  for i in $(seq 0 $REPCOUNT); do
        wake_nas
        ISAWAKE=$?
        if [ $ISAWAKE -eq 1 ]; then
                break
        fi
  done
  
  if [ $ISAWAKE -eq 1 ]; then
        echo "${NAS_IP} is awake, mounting ${NAS_SHARE} to ${MOUNT_NAME}.."
        mount_nas
  else
        echo "Error: Could not wake ${NAS_IP} in order to mount ${MOUNT_NAME}."
  fi
  
  
--------------------


------------------------------------------------------------------------
gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115
View this thread: http://forums.slimdevices.com/showthread.php?t=96338

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to