diff --git a/proxDoc.sh b/proxDoc.sh index e7c00ef..551aeca 100755 --- a/proxDoc.sh +++ b/proxDoc.sh @@ -102,10 +102,11 @@ get_temp_info() { get_disk_health() { echo -e "\n${GREEN}=== Disk Health Status ===${NC}" if command -v smartctl >/dev/null 2>&1; then - for disk in $(lsblk -d -o name | grep -E '^sd|^nvme'); do + while IFS= read -r disk; do + [[ -z "$disk" ]] && continue echo -e "\nChecking /dev/$disk:" - smartctl -H /dev/$disk - done + smartctl -H "/dev/$disk" + done < <(lsblk -d -o name | grep -E '^sd|^nvme') else log_message warn "smartctl not found. Install smartmontools for disk health monitoring" fi @@ -480,12 +481,13 @@ quick_health_check() { # Disk health (quick) echo -e "\n${GREEN}=== Disk Health Summary ===${NC}" if command -v smartctl >/dev/null 2>&1; then - for disk in $(lsblk -d -o name | grep -E '^sd|^nvme'); do - health=$(smartctl -H /dev/$disk 2>/dev/null | grep -i "health" | awk -F: '{print $2}' | xargs) + while IFS= read -r disk; do + [[ -z "$disk" ]] && continue + health=$(smartctl -H "/dev/$disk" 2>/dev/null | grep -i "health" | awk -F: '{print $2}' | xargs) if [[ -n "$health" ]]; then echo -e "/dev/$disk: $health" fi - done + done < <(lsblk -d -o name | grep -E '^sd|^nvme') fi # Node Exporter