Created
October 12, 2025 18:58
-
-
Save shaposhnikoff/39a35e7d5831d0de9c56623581db384b to your computer and use it in GitHub Desktop.
make fsteb entries fron showmount
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 | |
| SERVER="192.168.10.211" | |
| TMPFILE=$(mktemp) | |
| showmount -e $SERVER > "$TMPFILE" | |
| echo "# ===============================" | |
| echo "# NFS mounts for $SERVER" | |
| echo "# ===============================" | |
| tail -n +2 "$TMPFILE" | while read -r line; do | |
| EXPORT_PATH=$(echo "$line" | awk '{print $1}') | |
| CLIENTS=$(echo "$line" | awk '{print $2}') | |
| CLIENT_NET=$(echo "$CLIENTS" | cut -d'/' -f1) | |
| MOUNT_NAME=$(echo "$EXPORT_PATH" | sed 's#/#_#g' | sed 's/^_//') | |
| MOUNT_POINT="/mnt/${SERVER}_${MOUNT_NAME}" | |
| echo "mkdir -p $MOUNT_POINT" | |
| echo "${SERVER}:${EXPORT_PATH} ${MOUNT_POINT} nfs rw,sync,hard,intr,noatime,nofail 0 0" | |
| echo | |
| done | |
| rm -f "$TMPFILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment