macOS users - AutoMount your Shares

Recommended Posts

  • Replies 232
  • Created
  • Last Reply

Top Posters In This Topic

I know, this week has been hell and I have a shit ton of outside work to do as well, so I'm sorry--not getting mad at your, just this whole situation not working out.


I go through the logs, posted what I can.


I'll create a VMWare image of OS X I guess--but it may be quicker to just re-install unRAID 5.0 TBH.

Link to comment

Still confused.  Seems I was able to get at least Media to mount as RW now.  But the ping within the script still returns 0 packets when executed via the launchctl.


When I run on the command line as myself:


ping -q -c 1 tower


It sends 1 packet, and returns 1 packet--so, success


When I run the script,, on the command line:


PING ( 56 data bytes

--- ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.295/0.295/0.295/0.000 ms
Mounting Backup
Usage: file [-bcikLhnNrsvz0] [-e test] [-f namefile] [-F separator] [-m magicfiles] file...
       file -C -m magicfiles
Try `file --help' for more information.
Mounting Media
Usage: file [-bcikLhnNrsvz0] [-e test] [-f namefile] [-F separator] [-m magicfiles] file...
       file -C -m magicfiles
Try `file --help' for more information.


I don't know anywhere in the script that calls the 'file' command.  It still mounts the drives ok.


I just don't understand why it doesn't work through the .plist ????

Link to comment

Just did a search for "file" in my script. The last change I did must have been in TextEdit,  seems spellcheck changed fi to file  !!  However, this does not break the script so launchd will still run it. Your ping issue is very strange... Perhaps try changing the ping attempts to 5-10?


I'll change the script download soon. In the meantime, please remove "File" from your script, and then attach a copy of your script here, with everything but passwords in place.



Link to comment

Yeah, I think the 'file' was meant to close the 'elif' (since you put the conditional statement backwards to close it -- if -> fi, else -> esle)


But there really just needed to be the one 'fi' to close the whole block.  So there is also an extra 'fi' after you correct the 'file' statement--I just commented it out.


Attached is my file with my passwords removed.  Thanks for your help!

Link to comment

OK so took a look at the script. Very strange, honestly not sure why it's not working via LaunchD.


What I'd recommend is rebuilding that plist via an app called "Lingon" to suit your setup. Unless there's something funny with your network and it happens to only drop packets while you try it via Launchd (yeah right), then I can only suggest to try on another Mac to see if that's where the problem lies. Also, try different settings on the Ping command, and echo some debugging text to see where the problem might be lying. You can see most logging activity in the Console. You can add this for displaying text only in console. Either pipe in results, or add text inside quotes after the command:


logger -p local0.notice


Sorry I can't be of too much help here. In most cases you'd be more knowledgeable on the script side of things, so that's as far as I can go there.

Link to comment

Thanks for your help.  What are some other ping commands I could try?


Unfortunately, I only have one Mac, so I can't try that.


I will try assigning the onboard NIC back to eth0, and see if LaunchD works with the original NIC.




P.S. Know anywhere to get Lingon for free? Lol, my usual spot doesn't have it--or do you know a freeware app that does the same thing?


I could try running the script every minute via crontab

Link to comment
  • 3 weeks later...

Wow, Great work you guys. I am going to have to try this, as I get annoyed of the findered boxes opening up at login.

So do you have a step by step guide written, or an "official" script release? I noticed so many different versions throughout the thread.



Link to comment

FYI speeding_ant. Is it possible to add the config options (like username, password, IP address) to the .plist file?


I feel that may just make everything a bit easier, and less prone for error...if you passed arguments to the script from the launchd plist, instead of editing the script--but that's just me trying to make things more difficult I guess :P

Link to comment

Hey Defected - Naw I'm going to leave as it! It seems to work in its current state, and I've got other projects on now!


In terms of installation, the instructions on the first page are the "official" instructions. If you get stuck anywhere let me know and I'll amend them to make it easier to follow.



Link to comment
  • 2 weeks later...
  • 4 weeks later...
  • 1 month later...

Hello speeding_ant.


This is a great script and it is working well for me, with one small exception. I am running Lion with multiple users, and using fast user switching. I need for all of my users to have access to the shares once they are mounted and prefer that they all access the same mount point. My goal is to have a single user account setup the auto mount shares at login and for all other users to have access to it (775). Obviously, none would have access until the primary user logged in and auto mounted the shares.


The permissions for any shares created by this script is 700, and I can't seem to change it.  Any thoughts on how I could accomplish this? My config on the script posted below.


TIA for any help you can provide.




# Required for share mounting #

# Script Location

# Username for server

# Password for server, check notes

# IP Address/hostname for ping

# Hostname for server. Try sername.local, hostname or IP

# Protocol in lowercase, afp or smb

# Shares, check notes
SHARES="shared Videos"



Output of ls -l on /Volumes


iMac:Volumes Erik$ ls -l

total 8

lrwxr-xr-x  1 root  admin    1 Sep 17 15:28 Macintosh HD -> /

drwx------@ 7 Erik  staff  264 Sep 17 15:30 Videos

drwx------@ 9 Erik  staff  264 Sep 17 15:30 shared



Also notice that in the Get Info window, owner is shown as 'unknown', see attached screenshot.



Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.