Keep a Drive Mounted with Keyboard Maestro

March 23, 2012 by Gabe | [mmd] |

I have a Mac Mini that I use as a file server. One of it's jobs is to host a Drobo that I use as a backup drive. I have several macros and Hazel scripts that write files to the Drobo from my primary Mac. Occasionally the drive will unmount either through a restart or some other activity and my scripts and macros begin to fail.

I fixed the problem today with a Keyboard Maestro macro. Here's the setup.

Mount the drive and get info on it to see the server path.

Now setup a Keyboard Maestro macro that looks like this:

Macro Setup

This macro runs at login as well as every hour while I am logged in. The macro uses AppleScript to remount the drive if it is not already mounted.

Here's a closer look at the AppleScript

tell application "Finder"
    try
        mount volume "afp://userName@Mac%20mini._afpovertcp._tcp.local/Drobo"
    end try
end tell

Replace the "userName" string with your own user name on the server. If necessary, include the server password. Mine is stored in my keychain.

As always, this could be accomplished with other tools like cron. I just find it easier to manage everything in Keyboard Maestro.

blog comments powered by Disqus