Posted on 06-21-2010 12:57 AM
All,
We recently placed a new Mac Mini 10.6.x as an application server. This Mac
Mini has two necessary applications that run on it, and two necessary mounts
from other servers on the network. We have an AppleScript that runs at
startup on the Mini, (and remains active) which mounts these two volumes and
starts the applications. It loops every few minutes and checks to see if
either application is not running or if either volume is missing, and if so,
it restarts the missing application or remounts the missing volume.
Testing of the script (by just dismounting a volume) shows that it works
well, HOWEVER, in the real world, when one of the servers hosting the
mounted volumes restarts, a dialog window appears on the Mac Mini saying
that the volume has been disconnected. This dialog window, waiting for an
'OK' response, seems to suspend the execution of the AppleScript, so it does
not automatically remount the missing volume. As soon as I clear the dialog
window on the Mini (by hitting OK) the script will remount the missing
volume as it should.
I have not found a solution to clearing or closing this dialog window in
AppleScript. I think I need something like this:
if (dialog window exists) = true then
(activate dialog window)
(keystroke return)
end if
Does anyone know how to do this? Thanks!
--
Karl Schoenefeld | IT Department
SGS St Louis | 1035 Hanley Industrial Court | St Louis, MO 63144
Direct: 314-918-3126 | Cell: 314-680-0359
Posted on 06-21-2010 01:10 PM
Laucnhd and shell scripting would work just as well, and it would not
require a user to log in. Well, unless that application running on the
mini requires a user to own the process....I just helped Dan off the
list with something similar this is what I helped him with, still need
to hammer out the details on his though...
#!/bin/bash
# test path
VolumePath="/Volumes/TIS"
if [[ -e $VolumePath ]]
then /bin/echo "$VolumePath exists, exiting..." exit 0
else /bin/echo "$VolumePath does not exist....running mount script"
fi
/usr/bin/osascript <<AppleScript tell application "Finder" mount volume "afp://10.160.2.10/TIS" if (exists "TIS") then do shell script "open -a myapp" end if end tell AppleScript
exit 0
Have launchd run that every 15 minutes on the machine. If you have the
user account logged in and keychain credentials you will not have to put
passwords in the script. If you use kerberos you also should not need
to put password in the script to mount the share, now if you run neither
you may have to modify the mount part of the apple script to add
user:password in the afp part.
Just swap out TIS with your share points name and it should work. I
have done something similar in the past with assessment testing
software