Yesterday, I found a script that makes my Mac (MacBook Pro running El Capitan) automatically check for a volume on a server and remount it if the connection drops. I adapted it slightly to this, so my media server would remount when it drops (which is frequently):
on idle
tell application "Finder"
set isConnected to disk "Plex" exists
end tell
if isConnected = false then
try
mount volume "Plex" on server "smb://USER:[email protected]:445"
end try
end if
return 5
end idle
I saved the script as a Script Editor app using the "Stay open after run handler" option, so it runs in the background.
Yesterday it worked fine. Today, when it attempts to remount the Plex volume I get a "There was a problem connecting to the server" error.
However, I can connect to the server using the 'Connect to Server' command by entering the same IP address, user ID and password.
I'm logging into the NAS with an admin account, so there shouldn't be any disk permission issues.
Is there something in the script I've scrambled, or is this an issue with the Mac or NAS?
I'm completely new to scripting, so I may ask for clarifications on any answers.
I would like to include a link to the original script, but I can't recall where I found it.
Thanks.