Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing an Automator "script" that rsyncs media on my 10.6.3 MacBook Pro to my Ubuntu 10.10 HTPC. I can make Automator run my shell script for rsync commands, but I can't make Automator mount the three volumes on the HTPC (folders for music, videos, and pictures).

I automatically mount these volumes when I login (these computers connect via a wifi network), but sometimes the HTPC volumes get unmounted, so I'd like to remount by default.

Is there a way to mount the volumes in Automator? I am open to shell scripting, too. Thanks!

share|improve this question
up vote 8 down vote accepted

I build automator workflows like this all the time. You only need two actions, and they're both Files & Folders actions.

1) Get Specified Servers. This will let you build a list of shares to connect to. If you can map it from Finder -> Go -> Connect to server, you can use this.

2) Connect to Servers. This will connect to any servers passed to it (either from get specified servers or from ask for servers).

share|improve this answer
+agreed: this is exactly how i do it in an rsync workflow I use for syncing an iTunes library. Make sure you use Eject Volumes if you don't want the network drive to stay connected after the workflow completes. – Robert S Ciaccio Oct 19 '10 at 18:55
Eject Volumes is also handy if you want a "reverse" workflow. I use the procedure I outlined above as part of a workflow I run when I get to work (open programs, connect to servers and even remote into a virtual machine). At the end of the day, I have another one that disconnects all my servers and quits all my programs. – Ben Wyatt Oct 19 '10 at 19:05

I use the following applescript to mount directories in conjunction with MarcoPolo so network shares are automatically mounted when I get to both my office and home.

You'll need to change USERNAME, PASSWORD, SERVER/SHARENAME and possibly smb:// depending on your server type.

tell application "Finder"
        mount volume "smb://USERNAME:PASSWORD@SERVER/SHARENAME"
        delay 1
    end try
end tell

UPDATE: An option without MarcoPolo: You can ping the server first and only try to connect if you get a response. You can then add this script into your Login Items

(Let's say you are trying to connect to a server named "some_server")

-- (0) Check to see if there server exists by pinging it
set max_retry to 60
set k to 0
repeat while (do shell script "ping -c 1 some_server") contains "100% packet loss"
    delay 5
    set k to k + 1
    if k > max_retry then error "Server is not responding for predefined period." number 8000
end repeat

-- (1) It exists, mount the volume
tell application "Finder"
        mount volume "smb://USERNAME:PASSWORD@some_server/SHARENAME"
        delay 1
    end try
end tell
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.