From a042ad419e7347c9d63f068aa94759e689c9f96f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 28 Jul 2025 15:10:45 +0300 Subject: Update content for gemtext --- ...25-07-14-f3s-kubernetes-with-freebsd-part-6.gmi | 72 ++++++++++++--------- ...7-14-f3s-kubernetes-with-freebsd-part-6.gmi.tpl | 72 ++++++++++++--------- gemfeed/atom.xml | 74 ++++++++++++---------- 3 files changed, 124 insertions(+), 94 deletions(-) (limited to 'gemfeed') diff --git a/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.gmi b/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.gmi index f02d2c9f..d4377b82 100644 --- a/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.gmi +++ b/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.gmi @@ -1414,7 +1414,6 @@ For the automatic recovery, we create a script: MOUNT_POINT="/data/nfs/k3svolumes" LOCK_FILE="/var/run/nfs-mount-check.lock" -STATE_FILE="/var/run/nfs-mount.state" # Use a lock file to prevent concurrent runs if [ -f "$LOCK_FILE" ]; then @@ -1423,46 +1422,57 @@ fi touch "$LOCK_FILE" trap "rm -f $LOCK_FILE" EXIT -remount_it () { - # Try to fix - echo "Attempting to fix/remount NFS mount at $(date)" | systemd-cat -t nfs-monitor -p notice - umount -f "$MOUNT_POINT" 2>/dev/null - sleep 1 +fix_mount () { + echo "Attempting to remount NFS mount $MOUNT_POINT" + if mount -o remount -f "$MOUNT_POINT" 2>/dev/null; then + echo "Remount command issued for $MOUNT_POINT" + else + echo "Failed to remount NFS mount $MOUNT_POINT" + fi - if mount "$MOUNT_POINT"; then - echo "NFS mount fixed at $(date)" | systemd-cat -t nfs-monitor -p info - rm -f "$STATE_FILE" + echo "Checking if $MOUNT_POINT is a mountpoint" + if mountpoint "$MOUNT_POINT" >/dev/null 2>&1; then + echo "$MOUNT_POINT is a valid mountpoint" else - echo "Failed to fix NFS mount at $(date)" | systemd-cat -t nfs-monitor -p err + echo "$MOUNT_POINT is not a valid mountpoint, attempting mount" + if mount "$MOUNT_POINT"; then + echo "Successfully mounted $MOUNT_POINT" + return + else + echo "Failed to mount $MOUNT_POINT" + fi fi -} -# Quick check - ensure it's actually mounted -if ! mountpoint -q "$MOUNT_POINT"; then - echo "NFS mount not found at $(date)" | systemd-cat -t nfs-monitor -p err - remount_it -fi + echo "Attempting to unmount $MOUNT_POINT" + if umount -f "$MOUNT_POINT" 2>/dev/null; then + echo "Successfully unmounted $MOUNT_POINT" + else + echo "Failed to unmount $MOUNT_POINT (it might not be mounted)" + fi -# Quick check - try to stat a directory with a very short timeout -if timeout 2s stat "$MOUNT_POINT" >/dev/null 2>&1; then - # Mount appears healthy - if [ -f "$STATE_FILE" ]; then - # Was previously unhealthy, log recovery - echo "NFS mount recovered at $(date)" | systemd-cat -t nfs-monitor -p info - rm -f "$STATE_FILE" + echo "Attempting to mount $MOUNT_POINT" + if mount "$MOUNT_POINT"; then + echo "NFS mount $MOUNT_POINT mounted successfully" + return + else + echo "Failed to mount NFS mount $MOUNT_POINT" fi - exit 0 -fi -# Mount is unhealthy -if [ ! -f "$STATE_FILE" ]; then - # First detection of unhealthy state - echo "NFS mount unhealthy detected at $(date)" | systemd-cat -t nfs-monitor -p warning - touch "$STATE_FILE" + echo "Failed to fix NFS mount $MOUNT_POINT" + exit 1 +} + +if ! mountpoint "$MOUNT_POINT" >/dev/null 2>&1; then + echo "NFS mount $MOUNT_POINT not found" + fix_mount fi -remount_it +if ! timeout 2s stat "$MOUNT_POINT" >/dev/null 2>&1; then + echo "NFS mount $MOUNT_POINT appears to be unresponsive" + fix_mount +fi EOF + [root@r0 ~]# chmod +x /usr/local/bin/check-nfs-mount.sh ``` diff --git a/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.gmi.tpl b/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.gmi.tpl index b1a260c9..5548c7a6 100644 --- a/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.gmi.tpl +++ b/gemfeed/2025-07-14-f3s-kubernetes-with-freebsd-part-6.gmi.tpl @@ -1367,7 +1367,6 @@ For the automatic recovery, we create a script: MOUNT_POINT="/data/nfs/k3svolumes" LOCK_FILE="/var/run/nfs-mount-check.lock" -STATE_FILE="/var/run/nfs-mount.state" # Use a lock file to prevent concurrent runs if [ -f "$LOCK_FILE" ]; then @@ -1376,46 +1375,57 @@ fi touch "$LOCK_FILE" trap "rm -f $LOCK_FILE" EXIT -remount_it () { - # Try to fix - echo "Attempting to fix/remount NFS mount at $(date)" | systemd-cat -t nfs-monitor -p notice - umount -f "$MOUNT_POINT" 2>/dev/null - sleep 1 +fix_mount () { + echo "Attempting to remount NFS mount $MOUNT_POINT" + if mount -o remount -f "$MOUNT_POINT" 2>/dev/null; then + echo "Remount command issued for $MOUNT_POINT" + else + echo "Failed to remount NFS mount $MOUNT_POINT" + fi - if mount "$MOUNT_POINT"; then - echo "NFS mount fixed at $(date)" | systemd-cat -t nfs-monitor -p info - rm -f "$STATE_FILE" + echo "Checking if $MOUNT_POINT is a mountpoint" + if mountpoint "$MOUNT_POINT" >/dev/null 2>&1; then + echo "$MOUNT_POINT is a valid mountpoint" else - echo "Failed to fix NFS mount at $(date)" | systemd-cat -t nfs-monitor -p err + echo "$MOUNT_POINT is not a valid mountpoint, attempting mount" + if mount "$MOUNT_POINT"; then + echo "Successfully mounted $MOUNT_POINT" + return + else + echo "Failed to mount $MOUNT_POINT" + fi fi -} -# Quick check - ensure it's actually mounted -if ! mountpoint -q "$MOUNT_POINT"; then - echo "NFS mount not found at $(date)" | systemd-cat -t nfs-monitor -p err - remount_it -fi + echo "Attempting to unmount $MOUNT_POINT" + if umount -f "$MOUNT_POINT" 2>/dev/null; then + echo "Successfully unmounted $MOUNT_POINT" + else + echo "Failed to unmount $MOUNT_POINT (it might not be mounted)" + fi -# Quick check - try to stat a directory with a very short timeout -if timeout 2s stat "$MOUNT_POINT" >/dev/null 2>&1; then - # Mount appears healthy - if [ -f "$STATE_FILE" ]; then - # Was previously unhealthy, log recovery - echo "NFS mount recovered at $(date)" | systemd-cat -t nfs-monitor -p info - rm -f "$STATE_FILE" + echo "Attempting to mount $MOUNT_POINT" + if mount "$MOUNT_POINT"; then + echo "NFS mount $MOUNT_POINT mounted successfully" + return + else + echo "Failed to mount NFS mount $MOUNT_POINT" fi - exit 0 -fi -# Mount is unhealthy -if [ ! -f "$STATE_FILE" ]; then - # First detection of unhealthy state - echo "NFS mount unhealthy detected at $(date)" | systemd-cat -t nfs-monitor -p warning - touch "$STATE_FILE" + echo "Failed to fix NFS mount $MOUNT_POINT" + exit 1 +} + +if ! mountpoint "$MOUNT_POINT" >/dev/null 2>&1; then + echo "NFS mount $MOUNT_POINT not found" + fix_mount fi -remount_it +if ! timeout 2s stat "$MOUNT_POINT" >/dev/null 2>&1; then + echo "NFS mount $MOUNT_POINT appears to be unresponsive" + fix_mount +fi EOF + [root@r0 ~]# chmod +x /usr/local/bin/check-nfs-mount.sh ``` diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 2d953034..23402770 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,6 +1,6 @@ - 2025-07-28T14:27:18+03:00 + 2025-07-28T15:09:21+03:00 foo.zone feed To be in the .zone! @@ -1609,7 +1609,6 @@ http://www.gnu.org/software/src-highlite --> MOUNT_POINT="/data/nfs/k3svolumes" LOCK_FILE="/var/run/nfs-mount-check.lock" -STATE_FILE="/var/run/nfs-mount.state" # Use a lock file to prevent concurrent runs if [ -f "$LOCK_FILE" ]; then @@ -1618,46 +1617,57 @@ STATE_FILE="/var/run/nfs-mount.state" touch "$LOCK_FILE" trap "rm -f $LOCK_FILE" EXIT -remount_it () { - # Try to fix - echo "Attempting to fix/remount NFS mount at $(date)" | systemd-cat -t nfs-monitor -p notice - umount -f "$MOUNT_POINT" 2>/dev/null - sleep 1 +fix_mount () { + echo "Attempting to remount NFS mount $MOUNT_POINT" + if mount -o remount -f "$MOUNT_POINT" 2>/dev/null; then + echo "Remount command issued for $MOUNT_POINT" + else + echo "Failed to remount NFS mount $MOUNT_POINT" + fi - if mount "$MOUNT_POINT"; then - echo "NFS mount fixed at $(date)" | systemd-cat -t nfs-monitor -p info - rm -f "$STATE_FILE" + echo "Checking if $MOUNT_POINT is a mountpoint" + if mountpoint "$MOUNT_POINT" >/dev/null 2>&1; then + echo "$MOUNT_POINT is a valid mountpoint" else - echo "Failed to fix NFS mount at $(date)" | systemd-cat -t nfs-monitor -p err + echo "$MOUNT_POINT is not a valid mountpoint, attempting mount" + if mount "$MOUNT_POINT"; then + echo "Successfully mounted $MOUNT_POINT" + return + else + echo "Failed to mount $MOUNT_POINT" + fi fi -} -# Quick check - ensure it's actually mounted -if ! mountpoint -q "$MOUNT_POINT"; then - echo "NFS mount not found at $(date)" | systemd-cat -t nfs-monitor -p err - remount_it -fi + echo "Attempting to unmount $MOUNT_POINT" + if umount -f "$MOUNT_POINT" 2>/dev/null; then + echo "Successfully unmounted $MOUNT_POINT" + else + echo "Failed to unmount $MOUNT_POINT (it might not be mounted)" + fi -# Quick check - try to stat a directory with a very short timeout -if timeout 2s stat "$MOUNT_POINT" >/dev/null 2>&1; then - # Mount appears healthy - if [ -f "$STATE_FILE" ]; then - # Was previously unhealthy, log recovery - echo "NFS mount recovered at $(date)" | systemd-cat -t nfs-monitor -p info - rm -f "$STATE_FILE" + echo "Attempting to mount $MOUNT_POINT" + if mount "$MOUNT_POINT"; then + echo "NFS mount $MOUNT_POINT mounted successfully" + return + else + echo "Failed to mount NFS mount $MOUNT_POINT" fi - exit 0 -fi -# Mount is unhealthy -if [ ! -f "$STATE_FILE" ]; then - # First detection of unhealthy state - echo "NFS mount unhealthy detected at $(date)" | systemd-cat -t nfs-monitor -p warning - touch "$STATE_FILE" + echo "Failed to fix NFS mount $MOUNT_POINT" + exit 1 +} + +if ! mountpoint "$MOUNT_POINT" >/dev/null 2>&1; then + echo "NFS mount $MOUNT_POINT not found" + fix_mount fi -remount_it +if ! timeout 2s stat "$MOUNT_POINT" >/dev/null 2>&1; then + echo "NFS mount $MOUNT_POINT appears to be unresponsive" + fix_mount +fi EOF + [root@r0 ~]# chmod +x /usr/local/bin/check-nfs-mount.sh
-- cgit v1.2.3