Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How does I find out the afp mount point?

Hi,

I'm running a launchd job to backup some files to my AirportExtreme attached usb drive. I mount the afp share with:

mkdir /Volumes/share
mount_afp ip.ad.dr.ess/share

But there is a problem, when I have a drive with the same name! So when the other drive is mounted to /Volumes/share, my AE-afp is mounted to /Volumes/share-1 and my script runs and tries to mount the AW-afp I get a message that it's already mounted. The problem now is that I don't know the exact name of the moint point. I should now that it's mounted to /Volumes/share-1 but I don't know. My scripts now backups to the wrong volume!

Is there a way how to find out the afp mount point?

I tried applescript inside my shell script but when the launchd job runs I get an error -6600! So applescript/osascript doesn't work here!

Thanks for your help
Robert

ups sorry for my english!

Message was edited by: Robertmtk

Mac OS X (10.5.7)

Posted on Jun 30, 2009 3:17 AM

Reply
9 replies

Jun 30, 2009 6:59 AM in response to Robertmtk

Sorry I can't get what your problem is. mount_afp can take two arguments:

mount_afp afp://host/volume /path/to/the/local/mount/point

and the names of the "volume" and the mount "point" can be quite independent. For example I guess you can do the following:

mount_point=/Volumes/$$
mkdir $mount_point
mount_afp afp://host/volume $mount_point
----- backup your data to $mount_point -----
umount $mount_point
rmdir $mount_point

Jun 30, 2009 7:16 AM in response to Jun T.

Hey Jun,

the problem is:

1. Lets say I have a external drive called 'data'. When I connect the drive to my mac It get mounted to '/Volumes/data'.

2. I have a AirportExtreme USB disk also called 'data'. When I mount the afp share it get mounted to '/Volumes/data 1'. Normally it isn't mounted. But sometimes it is.

3. When my launchd job runs and the afp share is not mounted there is no problem because I know that '/Volumes/data' already exists and I can mount to any other directory. But when the afp share is mounted to '/Volumes/data 1' and I try to mount:
mkdir '/Volumes/data2'
mount_afp afp://10.0.1.5/data /Volumes/data2
I get a message from mount_afp that the share is already mounted.

My question is now: How do I know if the afp share is mounted to '/Volumes/data' or '/Volumes/data 1'

With applescript it would be no problem because 'mount volume "..."' will return the correct name even it is mounted. But applescript doesn't seem to work with launchd.

Do you understand me? Any idea?
Robert

Jul 1, 2009 4:00 PM in response to Robertmtk

1. Lets say I have a external drive called 'data'. When I connect the drive to my mac It get mounted to '/Volumes/data'.


I think Jun's point is that you do not have to mount the sharepoint under /Volumes or use the device's name for the mount point.

Using the command line you can mount any sharepoint at any location on your local system.

Consider:

mkdir /var/tmp/somesillydirectoryname
mount_afp afp://10.0.1.5/data /var/tmp/somesillydirectoryname


Now you can point your backup script to backup to /var/tmp/sillydirectoryname rather than anything in /Volumes.

The only reason to mount a sharepoint under /Volumes is for it to automatically appear on your desktop.

The other approach, if you do want to mount it under /Volumes, is to parse the results of something like df and check the paths to see if your server is mounted (and where).

Jul 2, 2009 2:02 AM in response to Camelot

Hi Camelot,

I understand what you're saying and it's a good idea but when the share is mounted by a user it will be in '/Volumes/data 1' and now it's not possible to mount it again by my shell script! Here I'm stucked because I cannot mount the share twice, I cannot unmount the existing share because I don't know the path and I cannot do my backup because I would backup to '/Volumes/data' which is wrong and should be '/Volumes/data 1'!

In this situation it's impossible to mount the share to any path. So you think the command df (or mount) is my only chance to get the path of the share?

Robert

Jul 3, 2009 5:44 AM in response to BobHarris

Thinking about this a little, if there is a space in the mount point name, then the little awk example would not work, as it would not return all parts of the mount point name.

So how about this bit of code

mount_point=$(mount | perl -n -e '
if ( /your unique identifying string here/ ) {
s/^S+ on //;
s/(.*//;
print;
}
')
if [[ "$mount_point" = "" ]]; then
echo not mounted
fi


Message was edited by: BobHarris

How does I find out the afp mount point?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.