Mac OSX Leopard and server connections
Sarah Reichelt
sarah.reichelt at gmail.com
Fri Feb 5 23:57:02 EST 2010
> I have a rather odd problem using rev applications on Mac OSX Leopard, connecting to a server on my network. I connect to a server with an Applescript command: do theScript as Applescript. I can do this just fine. But if I unmount the server by dragging it's icon to the trash, then remount from within Rev eventually Rev reads the name of the server differently. Let's say the name of the server is "George". I can connect to "George" several times, but eventually Rev or Leopard appends a digit to the name of the mounted volume.
>
> Originally, the path to file "Textfile.txt" on the server named "George" will be "/Volumes/George/Textfile.txt" However, after a few connections (don't know how many or exactly when this happens), the path to the file becomes "/Volumes/George-1/Textfile.txt". Oddly enough, the icon on the desktop for the volume is still "George". However, any reference to the file "Textfile.txt" from within Rev now will fail, since Rev reads the connection as "/Volumes/George-1/Textfile.txt" but is still looking for "/Volumes/George/Textfile.txt"! This gets somewhat frustrating, since I never know when it will happen, and once it does, I can no longer transfer files back and forth between the server and the computer.
>
> Has anyone seen this behavior? Do you have a workaround or a suggestion to get around this problem? I never had the problem working with pre-Leopard operating systems on the Mac, but it is now cropping up since all our computers in a lab are now running Leopard.
>
> Another issue may be that the physical server (now running OSX Snow Leopard) has several share points, each of which may be mounted as individual volumes, one of which is the aforementioned "George". Mounting and unmounting several of these share points may bring about the re-numbering issue. Rebooting the individual computer doesn't seem to help either.
This isn't just a Snow Leopard problem but has been around for a long
time. Here is the script I use for making network connections. The
example connects to a Public folder on a remote machine.
It includes a check for the shared folder not having been properly
disconnected, so avoids the -1 problem.
local sLastLoginAttempt
-- connect to remote server
--
on doRemoteLogin
-- retrieve these 3 parameters from custom props or other data storage
put the cRemoteIP of this stack into remoteIP
put the cLoginName of this stack into login
put base64decode(the cLoginPass of this stack) into pword
put "/Volumes/" & login & "/Public/" into tRemoteFolder
if the volumes contains login or there is a folder tRemoteFolder then
exit doRemoteLogin -- already logged in
end if
if remoteIP is empty OR remoteIP = "localhost" OR remoteIP =
"127.0.0.1" then
exit doRemoteLogin -- getting data locally
end if
if login is empty OR pword is empty then
exit doRemoteLogin -- not set up yet
end if
-- don't try more than once every 10 minutes, or it can lock up the program
if the seconds - sLastLoginAttempt < 600 then
exit doRemoteLogin
else
put the seconds into sLastLoginAttempt
end if
-- Shell commands:
-- mkdir /Volumes/emonitor
-- mount_afp afp://emonitor:jade05@192.168.0.101/emonitor /Volumes/emonitor
-- for a background task: "command > file_path 2>&1 &" or "command
>/dev/null 2>&1 &"
set the cursor to watch
if there is a folder ("/Volumes/" & login) then
-- was connected but didn't disconnect properly
put "rm -d /Volumes/" & login into tShellCmd
get shell(tShellCmd)
end if
put "mkdir /Volumes/" & login into tShellCmd
get shell(tShellCmd)
put "mount_afp afp://" & login & ":" & pword & "@" into tShellCmd
put remoteIP & "/" & login && "/Volumes/" & login after tShellCmd
put " > /dev/null 2>&1 &" after tShellCmd
get shell(tShellCmd)
-- keep checking for 10 seconds, then give up
repeat 10 times
set the cursor to busy
wait 1 second with messages
if the volumes contains login or there is a folder tRemoteFolder then
exit doRemoteLogin
end if
end repeat
end doRemoteLogin
HTH,
Sarah
More information about the use-livecode
mailing list