Created
December 1, 2025 00:53
-
-
Save alloydwhitlock/1ea2d08fba7a3590e19bd2e3060dffa8 to your computer and use it in GitHub Desktop.
Mounting Script for NFS
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
| #!/bin/bash | |
| # /usr/local/bin/mount-nas.sh | |
| NAS_IP="192.168.69.420" | |
| USERNAME="username" | |
| PASSWORD="password" | |
| SHARES=("Movies" "Music" "Shows" "Photos") | |
| echo "Starting Finder-based SMB mounting..." | |
| for share in "${SHARES[@]}"; do | |
| echo "Mounting $share..." | |
| # Use osascript to mount via Finder | |
| osascript -e " | |
| tell application \"Finder\" | |
| try | |
| mount volume \"smb://$USERNAME:$PASSWORD@$NAS_IP/$share\" | |
| return \"success\" | |
| on error | |
| return \"failed\" | |
| end try | |
| end tell | |
| " | |
| # Check if mounted | |
| if [ -d "/Volumes/$share" ] && [ "$(ls -A /Volumes/$share 2>/dev/null)" ]; then | |
| echo "✓ Successfully mounted $share" | |
| else | |
| echo "✗ Failed to mount $share" | |
| fi | |
| done | |
| echo "Mount script completed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment