fixes to mount scripts
This commit is contained in:
+48
-42
@@ -20,52 +20,58 @@ mount_cifs() {
|
||||
echo "Successfully mounted: $mount_point"
|
||||
}
|
||||
|
||||
function is_mounted() {
|
||||
mountpoint -q "$1"
|
||||
}
|
||||
|
||||
# Mount FRITZ.NAS (from fstab line 1)
|
||||
if ping -c 1 -W 1 "$HOST" >/dev/null 2>&1; then
|
||||
mount_cifs "//192.168.1.1/FRITZ.NAS" \
|
||||
"/home/honney/mount/fritzNAS" \
|
||||
"credentials=/home/honney/.cred/samba_credentials,uid=1000,gid=1000,vers=3.0,cache=none,nounix,noserverino,file_mode=0755,dir_mode=0755"
|
||||
if ! is_mounted "/home/honney/mount/fritzNAS"; then
|
||||
if ping -c 1 -W 1 "192.168.1.1" >/dev/null 2>&1; then
|
||||
mount_cifs "//192.168.1.1/FRITZ.NAS" \
|
||||
"/home/honney/mount/fritzNAS" \
|
||||
"credentials=/home/honney/.cred/samba_credentials,uid=1000,gid=1000,vers=3.0,cache=none,nounix,noserverino,file_mode=0755,dir_mode=0755"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
mount_points=("/home/honney/mount/Data" "/home/honney/mount/Media" "/home/honney/mount/Ripping" "/home/honney/mount/Apps")
|
||||
|
||||
if ping -c 1 -W 1 "192.168.188.122" >/dev/null 2>&1; then
|
||||
# Mount Data (from fstab line 2)
|
||||
mount_cifs "//100.64.0.3/Data" \
|
||||
"/home/honney/mount/Data" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
|
||||
# Mount Media (from fstab line 3)
|
||||
mount_cifs "//100.64.0.3/Media" \
|
||||
"/home/honney/mount/Media" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
|
||||
# Mount Ripping (from fstab line 4)
|
||||
mount_cifs "//100.64.0.3/Ripping" \
|
||||
"/home/honney/mount/Ripping" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
|
||||
# Mount Apps (from fstab line 5)
|
||||
mount_cifs "//100.64.0.3/Apps" \
|
||||
"/home/honney/mount/Apps" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
echo "192.168.188.122, mounting shares..."
|
||||
echo ""
|
||||
mounts=("//192.168.188.122/Data" "//192.168.188.122/Media" "//192.168.188.122/Ripping" "//192.168.188.122/Apps")
|
||||
for i in "${!mounts[@]}"; do
|
||||
mount="${mounts[$i]}"
|
||||
mount_point="${mount_points[$i]}"
|
||||
echo "Checking $mount_point"
|
||||
if ! is_mounted "$mount_point"; then
|
||||
echo "$mount_point unmounted"
|
||||
mount_cifs "$mount" \
|
||||
"$mount_point" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
else
|
||||
echo "$mount_point already mounted"
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
|
||||
elif ping -c 1 -W 1 "100.64.0.3" >/dev/null 2>&1; then
|
||||
# Mount Data (from fstab line 2)
|
||||
mount_cifs "//192.168.188.122/Data" \
|
||||
"/home/honney/mount/Data" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
|
||||
# Mount Media (from fstab line 3)
|
||||
mount_cifs "//192.168.188.122/Media" \
|
||||
"/home/honney/mount/Media" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
|
||||
# Mount Ripping (from fstab line 4)
|
||||
mount_cifs "//192.168.188.122/Ripping" \
|
||||
"/home/honney/mount/Ripping" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
|
||||
# Mount Apps (from fstab line 5)
|
||||
mount_cifs "//192.168.188.122/Apps" \
|
||||
"/home/honney/mount/Apps" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
echo "192.168.188.122 unreachable"
|
||||
echo "100.64.0.3 reachable, mounting shares..."
|
||||
echo ""
|
||||
mounts=("//100.64.0.3/Data" "//100.64.0.3/Media" "//100.64.0.3/Ripping" "//100.64.0.3/Apps")
|
||||
for i in "${!mounts[@]}"; do
|
||||
mount="${mounts[$i]}"
|
||||
mount_point="${mount_points[$i]}"
|
||||
echo "Checking $mount_point"
|
||||
if ! is_mounted "$mount_point"; then
|
||||
echo "$mount_point unmounted"
|
||||
mount_cifs "$mount" \
|
||||
"$mount_point" \
|
||||
"credentials=/home/honney/.cred/trueNAS_credentials,vers=3.1.1,iocharset=utf8,rw,uid=1000,gid=1000,nounix,noperm,file_mode=0660,dir_mode=0770,hard,intr,cache=loose"
|
||||
else
|
||||
echo "$mount_point already mounted"
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user