Computing.Net > Forums > Linux > Weird Script Hangs

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Weird Script Hangs

Reply to Message Icon

Name: dataking
Date: June 25, 2003 at 08:10:55 Pacific
OS: RedHat 9.0
CPU/Ram: P-III/384MB
Comment:

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/bash

mntdrv() {
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
esac

echo $"SMB Drives currently mounted:"
mount | grep smbfs

exit $?


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!



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: June 25, 2003 at 09:31:53 Pacific
Reply:

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.


0

Response Number 2
Name: dataking
Date: July 20, 2003 at 00:43:34 Pacific
Reply:

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!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Etec internal v92 pci har... RedHat 8 locks up when co...



Post Locked

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


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: Weird Script Hangs

hangs due to script in rc.d www.computing.net/answers/linux/hangs-due-to-script-in-rcd/5598.html

Boot Problem (proc mount) www.computing.net/answers/linux/boot-problem-proc-mount/4344.html

modem hangs up at 1092.1 minutes www.computing.net/answers/linux/modem-hangs-up-at-10921-minutes/4917.html