feat(storage): auto-mount ZSpace Z4 20TB SMB shares on Mac mini with LaunchAgent reconnect

Browse Source
This commit is contained in:
Yin Kou committed 2026-11-06 22:41:28 +08:00
1 parent a9f03f1a08
commit 88af316845
3 files changed
+45 -5

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# ==============================================================================
# mount-zspace.sh
# 用途:在 Mac mini 上自动挂载极空间 Z4 (192.168.31.185) 的 SMB 共享目录并保持断线自动重连
# 挂载点:~/nas/共享文件 & ~/nas/个人空间
# ==============================================================================
set -euo pipefail
NAS_IP="192.168.31.185"
if [ -f "$HOME/homelab/.env" ]; then
# shellcheck disable=SC1091
source "$HOME/homelab/.env"
fi
NAS_BASE="$HOME/nas"
mkdir -p "$NAS_BASE/共享文件" "$NAS_BASE/个人空间"
# 检查极空间是否在线
if ! ping -c 1 -W 1000 "$NAS_IP" >/dev/null 2>&1; then
exit 0
fi
# 1. 挂载「共享文件」(%E5%85%B1%E4%BA%AB%E6%96%87%E4%BB%B6)
if ! mount | grep -q "$NAS_BASE/共享文件"; then
mount_smbfs "//${SMB_USER}:${SMB_PASS}@${NAS_IP}/%E5%85%B1%E4%BA%AB%E6%96%87%E4%BB%B6" "$NAS_BASE/共享文件" 2>/dev/null || true
fi
# 2. 挂载「185XXXX1015」(个人空间)
if ! mount | grep -q "$NAS_BASE/个人空间"; then
mount_smbfs "//${SMB_USER}:${SMB_PASS}@${NAS_IP}/185XXXX1015" "$NAS_BASE/个人空间" 2>/dev/null || true
fi