back to scripts

nas-health-report.sh

bash 29 lines secrets redacted

Overall NAS health & availability report.

Note Live script from my home-lab server. Tokens, IDs, phone numbers and other secrets have been replaced with placeholders like <WHATSAPP_GROUP_ID> — everything else is the real, running code.
#!/usr/bin/env bash
set -u
REPORT_DIR=/home/lanky/reports
mkdir -p "$REPORT_DIR"
TMP=$(mktemp "$REPORT_DIR/nas-health.XXXXXX")
LATEST="$REPORT_DIR/nas-health-latest.txt"
{
  echo "NAS Health Report"
  echo "Generated: $(date -Is)"
  echo
  echo "== Mounts =="
  if mountpoint -q /mnt/nas; then echo "OK: /mnt/nas mounted"; else echo "BAD: /mnt/nas not mounted"; fi
  if mountpoint -q /mnt/jelly; then echo "OK: /mnt/jelly mounted"; else echo "BAD: /mnt/jelly not mounted"; fi
  echo
  echo "== Mount Details =="
  findmnt -rn --target /mnt/nas || true
  findmnt -rn --target /mnt/jelly || true
  echo
  echo "== Space =="
  timeout 10s df -hT /mnt/nas /mnt/jelly 2>/dev/null || echo "WARN: df timed out or failed"
  echo
  echo "== Recent CIFS/IO Warnings =="
  journalctl -k --since '24 hours ago' --no-pager | grep -Ei 'cifs|smb|i/o error|input/output|nas' | tail -80 || true
  echo
  echo "Deep duplicate/temp-file scanning is handled by /home/lanky/scripts/nas-duplicate-report.sh weekly."
} > "$TMP" 2>&1
chmod 0644 "$TMP"
mv "$TMP" "$LATEST"
echo "$LATEST"

back to scripts