mount-health-check.sh 518 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. set -euo pipefail
  3. MOUNT_POINT=${MOUNT_POINT:-"/mnt/seaweedfs"}
  4. # Check if mount point exists and is mounted
  5. if [[ ! -d "$MOUNT_POINT" ]]; then
  6. echo "Mount point $MOUNT_POINT does not exist"
  7. exit 1
  8. fi
  9. if ! mountpoint -q "$MOUNT_POINT"; then
  10. echo "Mount point $MOUNT_POINT is not mounted"
  11. exit 1
  12. fi
  13. # Try to list the mount point
  14. if ! ls "$MOUNT_POINT" >/dev/null 2>&1; then
  15. echo "Cannot list mount point $MOUNT_POINT"
  16. exit 1
  17. fi
  18. echo "Mount point $MOUNT_POINT is healthy"
  19. exit 0