blob: ccac03326f0a2cc0fe9c3fe3e9adbf212b08b800 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env bash
set -euo pipefail
BASE="/mnt/sharepoint"
MPS=(
"$BASE/Administration"
"$BASE/Operations"
"$BASE/SkyscaleCommerce"
)
is_mounted() { findmnt -rn "$1" >/dev/null 2>&1; }
# Do not stay inside any mount
cd /
for mp in "${MPS[@]}"; do
if ! is_mounted "$mp"; then
echo "Not mounted: $mp"
continue
fi
echo "Unmounting: $mp"
if ! fusermount3 -u "$mp" 2>/dev/null; then
fusermount3 -uz "$mp" 2>/dev/null || sudo umount -l "$mp" 2>/dev/null || {
echo "ERROR: failed to unmount $mp"
exit 1
}
fi
done
# Optional: kill any leftover rclone mount processes still referencing /mnt/sharepoint
pkill -f "rclone mount.*${BASE}" 2>/dev/null || true
|