0

My Mac runs a daily script (via cron) that mounts an AFP network share on a remote server, writes to it, and unmounts the share. Unfortunately, the script has a side-effect of opening a Finder window to view the network share, which pops up in the middle of the user's day, interrupting their work. Is there a way to mount the network share without opening the Finder window?

I mount the network share using the open command (/usr/bin/open):

open afp://username:[email protected]/MyVolumeName

I've already tried the -g option (Do not bring the application to the foreground) and the -j option (Launches the app hidden) for open, but the Finder window still appears.

Thanks.

1

1 Answer 1

1

The open command, opens the file/folder/share using the default application of the the file/folder/share type. In this case Finder.

You need the mount command. Try:

mkdir MyVolumeName
mount_afp afp://username:[email protected]/MyVolumeName myVolumeName

You don't need the mkdir if the mount point already exists as an empty folder. But read the documentation first with man mount_afp.

Unless you have a reason to use AFP, it is generally better to use SMB using mount_smbfs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .