Drive Mount Ping Monitor

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Drive Mount Ping Monitor Thu Apr 27, 2017 3:34 pm • by shawnjanes
Hi,

I have been reading the forums ALL day and have gotten close to solving my problem, but no joy.

Here's what I'm trying to do:

PROBLEM:
I have a NAS where I keep my movies and tv shows. I want to mount the drives for these locations and if they become disconnected through either the NAS being restarted or the network losing connectivity I want to have them remount.

Here's how far I've gotten and for this discussion I will just stick with the movies mount:

If all of the following conditions are met for the folder /volumes:
> Name is not Movies
> Pass shell script / embedded script /
Code: Select all
if [ -d "/Volumes/Movies" ]; then exit 1; else exit 0; fi

Do the following to the matched file or folder:
>Run AppleScript / embedded script /
Code: Select all
tell application "Finder" try mount volumes "afp://192.168.2.181/Movies" end try end tell

>Display notification with pattern: Media mounted (Movies)

Ok, so everything works. The only issue I am trying to solve for is lets say I reboot the NAS for a software update. The mounted drive will then disconnect, Hazel will notice this and try to reconnect the drive, this results in an error about the drive not being found and pop-up a system dialogue box. The only way to get past this is to click ok, then let Hazel run again and once the NAS is back on the network the drive will mount again with no issues.

How do I solve for this pop-up window? Is there a way Hazel can check to see if the NAS is online? Would a ping of the NAS work?

I appreciate any guidance you can provide. I am not an AppleScript expert, so speak slowly and carefully. ;-)

Shawn.
shawnjanes
 
Posts: 2
Joined: Thu Apr 27, 2017 3:17 pm

Re: Drive Mount Ping Monitor Thu Apr 27, 2017 4:27 pm • by Mr_Noodle
This is outside of the support scope for Hazel. I guess you can try pinging it. It would just check whether the device is responding to general network requests but may not be indicative of whether it is ready to serve files.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Drive Mount Ping Monitor Thu Apr 27, 2017 4:40 pm • by shawnjanes
Ok, maybe I posted in the wrong spot. I was more looking to see if anyone had suggestions. I understand Hazel is working as it should. Love the application been using it since 2010.
shawnjanes
 
Posts: 2
Joined: Thu Apr 27, 2017 3:17 pm


Return to Support