Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I wrote this little script to mount all of my smb shares (from WinXP), and for some reason it hangs on random shares. Sometimes it'll hang on the first one...sometimes on the last one....it doesn't seem to really matter. I've included the code below.
Code:
#!/bin/bashmntdrv() {
for drive in ${mydrive[@]} ;do
echo $"Mounting ${drive} ..."
smbmount //charlie-xp/${drive} /mnt/smb/${drive} -o username=,password=
done
}
case "$1" in
linux)
mydrive="linux"
mntdrv ${mydrive}
;;
pix)
mydrive="pix"
mntdrv ${mydrive}
;;
mp3s)
echo $"The mp3s share cannot be mounted because it hangs. I'm pretty sure this is because it is on an NTFS drive. This is under investigation."
# mydrive="mp3s"
# mntdrv ${mydrive}
;;
backups)
mydrive="backups"
mntdrv ${mydrive}
;;
all)
mydrive=( "backups" "linux" "pix" )
mntdrv ${mydrive}
;;
*)
echo $"Usage: $0 {all|linux|mp3s|backups|pix}"
exit 1
esacecho $"SMB Drives currently mounted:"
mount | grep smbfsexit $?
So, is it the script or something else? I know it's not permissions, most of the time I run this as root, and others, I have sudo setup so it will work. It usually works if I do one drive, but even hangs then sometimes. And it almost ALWAYS hangs on one share or another if I do the "all" option. Any suggestions would be great!

Just a guess, but you might try putting a pause (sleep 5) in the loop after the smbmount to see if that helps.
I haven't used smbmount but have a system at work that runs mountdavfs twice to mount two webdav connections. When run individually they both worked, but when I ran them consecutively in a script without a pause the second would fail. I just used 'sleep 5' and never experimented with shorter sleep times.

I actually just found the answer not to long ago. Aparrently there is a bug with the smb-client version that RH9 ships with. The following procedure should fix it for anyone else experiencing similar problems.
1. Change the /usr/bin/smbmount to /usr/bin/smbmount.orig
2. create a script with the following content named smbmount:
#!/bin/bash
export LD_ASSUME_KERNEL=2.2.5
exec /usr/bin/smbmount.orig $1 $2 $3 $4
3. chmod a+x /usr/bin/smbmount
4. You're done!

![]() |
Etec internal v92 pci har...
|
RedHat 8 locks up when co...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |