Question

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!

Was it helpful?

Solution

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).

OTHER TIPS

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"
    try
        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"
    try
        mount volume "smb://USERNAME:PASSWORD@some_server/SHARENAME"
        delay 1
    end try
end tell
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top