Announcement

Collapse
No announcement yet.

script to mount samba shares , guidance plz

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    script to mount samba shares , guidance plz

    ok say I'd like to add a line in /etc/network/interface , and create an executable script called mountsmbfs.sh , do you think something like this would work , and can someone help me with the syntax thanks

    overall requirements, after wlan0 is up, check status to ensure it's functional, also check what the SSID is so I don't try to mount shares when I'm on a differnet AP, then mount shares and exit

    Code:
     # The loopback interface
        iface lo inet loopback
    
     # The first network card
         iface wlan0 inet dhcp
         pre-up wpa_supplicant -i wlan0 -D hostap -c /etc/wpa_supplicant.conf
         pre-up sleep 5
         post-up /<pathtoscript>/mountsmbfs.sh
    Code:
      
    #! /bin/bash
    
    X="up"
    Y="MyWAPname"
    
    if [$X 	== wlan0 status && $Y == $SSID #not sure how to do this yet];then
       mount -t smbfs //servername/sharename /mountdirectory >
           credentials=/home/myhomedirectory/.smbpasswd dmask=777 fmask=777
    
      else
        null
    fi
    exit
    I'm looking to do something like this because when I set my laptops acpi management mode to standby/suspend when the lid is closed, upon opening the lid again the samba shares are lost, and I'd like them to remount when the nic comes back up.

    If anyone else has a better idea that would be great

    Thanks in Advance
    D.
Working...
X