Automount AFP shares failure

I have a question about mounting multiple volumes from the same file server. It’s not working as it seems it should and I have no idea why.

My main work machine is an MBP but I have a file server (and old G4 running 10.4.8 and SharePoints. I created a share named Lurch on the file server with SharePoints, set the owner to an admin account on the server, and the group to a group I created on the server. The group contains 2 usernames (non admin) on the server and these usernames to not exist on the laptop.

I then created an applescript using the mount volume command as follows:

mount volume “afp://username:password@IP_of_server/Sharename/”

and set this script to run at login.

This has been working perfectly for years; the volume Lurch is always mounted on the laptop.

I recently reorganized my backup routines for my laptop . . .and created a second share named Jeeves on the server to run the backup to. I don’t want Jeeves to be always mounted but to be mounted and dismounted when needed. SuperDuper can do this easily by running pre and post job scripts . . .so all I needed was a script to mount Jeeves.

So . . .I basically created a duplicate script to the one to mount the always mounted Lurch but changed the Sharename to Jeeves.
Username and password are the same, Jeeves is setup, shared, and permissioned identically to Lurch.

The problem happens when I try to run the Jeeves script.

By itself . . .the Jeevves mount script works perfectly, as does the Lurch mount script. However, if Lurch is already mounted then running the Jeeves script gives some random combination of the
following:

-correctly mounts the volume
-gives an error dialog “Disk some object wasn’t found” with Edit and OK buttons.
-clicking on the OK button always gives an error dialog that says “Open dictionary, unable to read the dictionary because it is not scriptable”
-clicking on the OK button dismisses the dialog and sometimes mounts the volume. Other times it just dismisses the dialog

I’ve done the following:

-verified that both scripts are correctly syntaxed -verified that either script works correctly if neither volume is mounted -verified that the problem occurs with either volume mounted; i.e., if I mount the normal Lurch volume then try Jeeves . . .the scenario described happens. If I dismount both, mount the Jeeves volume, and try to mount the Lurch volume the same scenario happens.

Since there is already a volume mounted with the username/password combination . . .shouldn’t a second volume similarly mount correctly?
Does anybody have an idea what might be going wrong here? Do I need to use a separate set of users/groups on the file server to mount the second volume?

Thanks in advance.

I had a similar problem in the past (and still do). The problem, to which I found no good reasoning, is simply that once you’ve mounted a volume the script won’t mount a second volume from the same server. So as for ideas… you can make the script unmount the other volume first (this is the approach I used and it works). The other idea, which I haven’t tested, would to use a terminal mount command.

set x to do shell script "mkdir /Volumes/sharename; mount -t afp afp://[username]@rhost/sharename /Volumes/sharename"

As an edit I just tried this and it seemed to work.

I manually mounted one volume (once through the finder and once through applescript (non shell script version) and then in a seperate script and the same was able to mount the second share through the script I provided above. Also mounting both volumes with the script above seems to work.

Further edit: I found on accident just now then when trying to mount the second volume with the non shell script version is working to a degree. What happens is that the volume is mounted to the file system, but not to the finder. You can verify this by trying it and then going to the terminal… Go to /Volumes and should see (I did) your volume that failed to mount and you can transverse it.

So hope that all helps to some degree.

James . . .thanks for your input. I’ll try the terminal script and see if I can get it to work properly for me.

I’m not sure where I read this, but my applescript notes tell me that passwords don’t work properly with the “mount volume” command. So in my applescripts I use the “open location” command instead. Here’s a script I use to mount external drives. You only need to make changes to the section labelled as “variables to change”.

-- variables to change
set diskNames to {"Movies01", "Movies02"} -- a list of the names of the disks you want to mount
set ipaddress to "192.168.1.201" -- IP address of the computer where the disks are attached
set username to "your_username" -- username used to log on to the external computer housing the drives
set psswrd to "your_password" -- login password, if you leave blank then you will be prompted for a password
set myDelay to 1

-- variables not to change
set numberDisks to count of diskNames
set numberMounted to 0
set diskList to {}
set finaldisk to {}

-- mount external hard drives, this will check to see if a drive is already mounted when the script is run
tell application "Finder"
	repeat with i from 1 to numberDisks
		set thisDisk to item i of diskNames
		if not (exists disk thisDisk) then -- check to see if the drive in the list is already mounted
			try
				open location ("afp://" & username & ":" & psswrd & "@" & ipaddress & "/" & thisDisk) -- or mount volume which doesn't allow passwords
				set numberMounted to numberMounted + 1 -- keep a counter of the number of drives mounted
				set diskList to diskList & thisDisk -- make a list of the drives mounted
			end try
		end if
	end repeat
end tell

-- this section is only executed if some drives are mounted
if not numberMounted = 0 then
	-- delay until the drives mount
	set finaldisk to item numberMounted of diskList
	repeat until (list disks) contains finaldisk
	end repeat
	delay myDelay
	
	-- close finder windows opened by the mounting drives
	tell application "Finder"
		repeat with i from 1 to numberMounted
			if Finder window 1 exists then close Finder window 1
		end repeat
	end tell
end if

Hmm, never thought to use open location I will have to try that. I can say though that yes passwords do work with mount volume.

I’ll give the open location command a try . . .although I agree . . .passwords do work for mounting volumes (at least for the first one from a server) . . .maybe the issue only arises when you try to mount the second volume.