Wednesday, August 10, 2022

#1 2005-02-25 11:01:44 am

kfrankovich
Member
Registered: 2005-02-25
Posts: 7

Mount Volume Throws Error when server not available

Greetings,

I am trying to write a script that allows me to check the status of a number of mounted volumes and remount them if they get disconnected.  The usual reason for disconnection is that the server got rebooted.  I run the script every 5 minutes using CRON and it works fine.  The only problem is if the script runs before the server comes back up...the mount volume command throws an error that apparently cannot be trapped or dismissed.  If the server is unavailable, i get a dialog box that says "Connection Failed"  No response from the server.  Please try again.

There is an OK button on it and the script will not continue until the OK button is clicked.  If you click it...the script tries to mount the volume again and throws the same error if the server is not yet back up.  I must click OK a second time to ge the script to finally move on the next volume. 

Does anybod know how to get rid of this error?

The command I am using to mount the volume is:

try
with timeout of 10 seconds
mount volume "afp://server/volume" as user name "name" with password "password"
end timeout
end try

Thanks in advance for any help.

Offline

 

#2 2005-02-26 12:26:56 am

Brandon Carpenter
Member
From:: Amarillo, Tx
Registered: 2002-11-20
Posts: 87
Website

Re: Mount Volume Throws Error when server not available

You might want to consider something like one of the following:

Applescript:

tell application "Finder"
repeat until (exists disk "Files")
activate application "Finder"
with timeout of 20 seconds
mount volume "afp://server/volume" & "/Files" as user name "myName" with password "myPass"
end timeout

Finder is not always necessary:

Applescript:


set list_disks to list disks
   set ThisVolume to "afp://server"
   try
       if (list disks) does not contain "mountVol" then mount volume ThisVolume
   end try
   try --this will reveal the drive in a Finder window
       reveal folder "mountVol"
   end try

In a Handler:

Applescript:


on mountVol()
set mVol to list disks
set volId to item 1 of mVol
repeat with volId in mVol
if volId as text = "mount_VOLUME" then
return true
end if
end repeat
return false
end mountVol

I use this one the most in my scripts:

Applescript:

tell application "Finder"
       set mounted_Disks to list disks
       --display dialog result as string
       --set mounted_Disks to every disk whose (ejectable is true)
       if mounted_Disks does not contain "INGEST" then
           mount volume "cifs://10.10.10.12/mount_Vol/" as user name "username" with password "password"
       end if
   end tell

There are otherr ways, too, of mounting a Volume. Good Luck


Filed under: Finder

Offline

 

#3 2005-02-26 11:29:06 am

kfrankovich
Member
Registered: 2005-02-25
Posts: 7

Re: Mount Volume Throws Error when server not available

Thank you for your reply...however it did not address my specific issue.  Allow me to be more clear.

I can check for and mount the volumes just fine WHEN THE SERVERS ARE AVAILABLE.  The problem is the script dies at the mount volume command IF THE SERVER IS DOWN.

If I run this command:
mount volume "afp://nonexistenserver/nonexsistentvolume" as user name "fake" with password "fake"

The mount volume command (NOT MY SCRIPT) will generate a connection error and will prompt with a dialog box that I must answer "OK" to in order for the script to continue.

Keep in mind...the server does actually exist...it is just temporarily unreachable.  So what I need is either a way around this weird behavior of the mount volume command or a way to check that the server is running before I try and mount the volume.

Thank you again for your help.

Offline

 

#4 2007-12-24 01:09:58 pm

johnellisdm
Member
Registered: 2007-02-19
Posts: 1

Re: Mount Volume Throws Error when server not available

i had to do something similar for ical scheduled timemachine backups.  this script will close the window a bit, but not completely.  it uses "ping" to determine if the host is available.  there is still the chance, when the machine is starting up, that it will be pingable, but not able to mount the drive.

Applescript:



set mountTm to true
set runBackup to true

tell application "Finder"
   set disklist to list disks
   
   repeat with i from 1 to number of items in disklist
       if item i of disklist is equal to "timemachine" then
           set mountTm to false
       end if
   end repeat
end tell

set ping_result to (do shell script "ping -c 1 mako; echo none")
if ping_result is equal to "none" then
   set mountTm to false
   set runBackup to false
end if

if mountTm then
   ignoring application responses
       mount volume "smb://mako/timemachine"
   end ignoring
end if
if runBackup then
   try
       do shell script "/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper"
   end try
end if


Filed under: Finder

Offline

 

#5 2007-12-24 01:40:31 pm

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11771
Website

Re: Mount Volume Throws Error when server not available

Hi John,

nice to meet you here again smile

Your script is quite complicated, this is an easier version
(regardless of the problem to make Time Machine backups on network volumes wink)

Applescript:


if "timemachine" is not in (do shell script "ls /Volumes") then
   try
       mount volume "smb://mako/timemachine"
   on error
       return -- abort the script
   end try
end if
try
   do shell script "/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper"
end try


regards

Stefan

Offline

 

#6 2010-06-24 08:12:44 am

gleam
Member
Registered: 2009-12-28
Posts: 18

Re: Mount Volume Throws Error when server not available

Hello,

I've been struggling with the unsuppressable error-message for a while now, but can't seem to find a real solution anywhere.

While the ping-solution test for the server works, there's still a chance the server is not offering the volume yet (like John says), is there a way to test for the volume being available as well before using AS's "mount volume" command?

B.t.w., the command "open location" has a parameter "without error reporting", which seemed promising, but this command does not seem to work in my particular situation

Applescript:

-- this works, IF the volume is available on the network, otherwise it displays the uninterceptible modal error dialog
mount volume "afp://workstation:workstation@192.168.0.27/Backup"

-- this does nothing at all
open location "afp://workstation:workstation@192.168.0.27/Backup"

I need to set up a number of machines with unsupervised backups, so any help on this would be more than welcome.


Filed under: mount volume error

Offline

 

#7 2010-06-24 08:19:02 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11771
Website

Re: Mount Volume Throws Error when server not available

Hi,

look into this thread


regards

Stefan

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)