Help automounting a network share if it gets disconnected.


Recommended Posts

I've got a Raspberry Pi which has a couple of hard drives connected to it with my media on them and they are shared.

 

I've got Plex running on an old mac mini which is looking for the media that the Pi is sharing.

 

This works fine as long as I don't have to reboot the Pi (which I have to do more than I'd like), then the mac obviously loses the drives.

 

I found a script which is supposed to check to see if the drives are mounted every X minutes and if they aren't re-mount them.

 

## Save this as an applescript application with the “always open” checkbox checked.
on idle
	tell application "Finder"
		## this checks to see if "usb" exists (mounted) then sets a true/false value to the variable "isConnected".
		set isConnected to disk "usb" exists
		set isConnected2 to disk "usb2" exists
	end tell
	## this checks variable "isConnected" and if "false" then it tries to mount the volume given the server name (or ip address).
	if isConnected = false then
		try
			mount volume "usb" on server "192.168.1.71"
		end try
	end if
	if isConnected2 = false then
		try
			mount volume "usb2" on server "192.168.1.71"
		end try
	end if
	## this repeats the loop every 5 minutes; this value can be increased.
	return 300
end idle

However it doesn't seem to be working.

 

The mac has the username and password for the Pi's share stored in it's keyring and if I manually browse to the drives I'm never asked for a password.

 

Anyone have any ideas on why the script isn't working (the script is being run as a startup)

  • +unabatedshagie locked and unlocked this topic
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.