diff options
Diffstat (limited to 'gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.html')
| -rw-r--r-- | gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.html | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.html b/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.html index 374ec9a2..7963fb4d 100644 --- a/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.html +++ b/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.html @@ -1611,6 +1611,22 @@ STATE_FILE=<font color="#808080">"/var/run/nfs-mount.state"</font> touch <font color="#808080">"$LOCK_FILE"</font> <b><u><font color="#000000">trap</font></u></b> <font color="#808080">"rm -f $LOCK_FILE"</font> EXIT +mount_it () { + <b><u><font color="#000000">if</font></u></b> mount <font color="#808080">"$MOUNT_POINT"</font>; <b><u><font color="#000000">then</font></u></b> + echo <font color="#808080">"NFS mount fixed at $(date)"</font> | systemd-cat -t nfs-monitor -p info + rm -f <font color="#808080">"$STATE_FILE"</font> + <b><u><font color="#000000">else</font></u></b> + echo <font color="#808080">"Failed to fix NFS mount at $(date)"</font> | systemd-cat -t nfs-monitor -p err + <b><u><font color="#000000">exit</font></u></b> <font color="#000000">1</font> + <b><u><font color="#000000">fi</font></u></b> +} + +<i><font color="silver"># Quick check - ensure it's actually mounted</font></i> +<b><u><font color="#000000">if</font></u></b> ! mountpoint -q <font color="#808080">"$MOUNT_POINT"</font>; <b><u><font color="#000000">then</font></u></b> + echo <font color="#808080">"NFS mount not found at $(date)"</font> | systemd-cat -t nfs-monitor -p err + mount_it +<b><u><font color="#000000">fi</font></u></b> + <i><font color="silver"># Quick check - try to stat a directory with a very short timeout</font></i> <b><u><font color="#000000">if</font></u></b> timeout 2s stat <font color="#808080">"$MOUNT_POINT"</font> >/dev/null <font color="#000000">2</font>>&<font color="#000000">1</font>; <b><u><font color="#000000">then</font></u></b> <i><font color="silver"># Mount appears healthy</font></i> @@ -1634,12 +1650,7 @@ echo <font color="#808080">"Attempting to fix stale NFS mount at $(date)"</font> umount -f <font color="#808080">"$MOUNT_POINT"</font> <font color="#000000">2</font>>/dev/null sleep <font color="#000000">1</font> -<b><u><font color="#000000">if</font></u></b> mount <font color="#808080">"$MOUNT_POINT"</font>; <b><u><font color="#000000">then</font></u></b> - echo <font color="#808080">"NFS mount fixed at $(date)"</font> | systemd-cat -t nfs-monitor -p info - rm -f <font color="#808080">"$STATE_FILE"</font> -<b><u><font color="#000000">else</font></u></b> - echo <font color="#808080">"Failed to fix NFS mount at $(date)"</font> | systemd-cat -t nfs-monitor -p err -<b><u><font color="#000000">fi</font></u></b> +mount_it EOF [root@r0 ~]<i><font color="silver"># chmod +x /usr/local/bin/check-nfs-mount.sh</font></i> </pre> |
