Created
May 1, 2026 06:38
-
-
Save d4kine/a636792bceca6b56cf7b7bce26f0ccba to your computer and use it in GitHub Desktop.
MacOSX auto-mount network-shares after hibernate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set server to "[HOSTNAME]" | |
| set mounts to {"/Volumes/[SHARE]"} | |
| set serverReachable to (do shell script "ping -c 1 -t 1 " & server & " | grep '1 packets received' | wc -l") as integer | |
| (* DEBUG | |
| repeat with mountPath in mounts | |
| do shell script "echo 'mountPath: " & server & "/" & (text 10 thru -1 of mountPath) & "'" | |
| end repeat | |
| *) | |
| if serverReachable is equal to 1 then | |
| tell application "Finder" | |
| repeat with mountPath in mounts | |
| if not (exists POSIX file mountPath) then | |
| try | |
| mount volume "smb://" & server & "/" & (text 10 thru -1 of mountPath) | |
| end try | |
| end if | |
| end repeat | |
| end tell | |
| end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment