Mapping Another MAC Hard Drive Using Shell Script

Joined
Mar 2, 2016
Messages
89
Reaction score
1
Greetings all ...

I have 2 Mac Minis known as SystemB and SystemC. My question is that, using a shell script invoked by cron under Terminal, I would like to mount the hard disk of SystemB from SystemC. This is easy enough to do using Finder, but none of the mount commands I've tried in my shell script have worked.

I tried mounting SystemB's HD using Finder and then running my cron script, but the Finder connection drops at some later point in time, because after that point the cron script reports it can't connect to the drive. My assumption is that the Finder connection must have some kind of automatic timeout due to inactivity. So, what I want the script on SystemC to do is mount SystemB's HD, copy off a few files, then umount SystemB's HD.

Can anyone give me a clue? Both Minis are running El Capitan with all maintenance applied.
 
Joined
Mar 2, 2016
Messages
89
Reaction score
1
Hello,

You may not need a cron job...try this:

How to Automatically Connect to a Network Drive at Login in OS X

Let us know if that works for you,

C
Thanks Cory - while I understand that I can do it this way, there's no need to be connected constantly, and the goal here is to learn how to do this using the mount command. I've used mount/umount before on other systems (like Ubuntu) so I don't understand what I need to do on MacOS to achieve the same result.
 
Joined
Mar 2, 2016
Messages
89
Reaction score
1
On another thread, I found someone using Sierra had done this with the "open" command. Since I'm at the highest release of El Cap before the release of Sierra, I tried the "open" command to see if it worked, and it did. Here is the (sanitized) command I'm currently using:

open 'smb://User:User&123@MAC-SYSTEMB/Desktop'

Originally the user password contained an "@" (i.e., "User@123"), but I simply could not escape this no matter what quoting or backslash options I tried, so I changed the "@" in the password to an "&", which works as long as I quote the "open" argument as shown.

Now, this is an OK solution, but it is not an ideal solution, because the "open" command above opens a Finder window when the "open" completes. This means that every time my "cron" script runs, it opens the Finder window on my desktop. I would really rather it didn't do that. So, I'm still open to suggestions on how to network-map the hard-drive on SystemB from SystemC. There doesn't seem to be a "nfsmount" or "netmount" command in the shell, and I don't see (or, perhaps, don't understand) how any of the options on "mount" that would let me do this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top