From 8c3badf02f06e63e017235e52b71a31ba751222f Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 8 Aug 2024 17:02:59 +0200 Subject: [PATCH] ledcontrol: add smartcheck while boot Signed-off-by: AuxXxilium --- ledcontrol/all/usr/bin/ledcontrol.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ledcontrol/all/usr/bin/ledcontrol.sh b/ledcontrol/all/usr/bin/ledcontrol.sh index 2100cbb..9baabbc 100755 --- a/ledcontrol/all/usr/bin/ledcontrol.sh +++ b/ledcontrol/all/usr/bin/ledcontrol.sh @@ -41,16 +41,21 @@ else $UGREEN_LEDS_CLI netdev -on -color $color -brightness $brightness > /dev/null 2>&1 fi + # CPU + $UGREEN_LEDS_CLI power -on -color $color -brightness $brightness > /dev/null 2>&1 + # Disks devices=($(ls -d /dev/sata*[1-9] 2>/dev/null | grep -v 'p')) for i in "${!devices[@]}"; do - # [ "${devices[$i]}" = "/dev/${bootdisk}" ] && continue device=${devices[$i]} disk_number=$((i + 1)) # Disknummer für die LED-Steuerung (disk1, disk2, etc.) + smartstatus=$(smartctl -H "/dev/sata$disk_number" | grep "SMART Health Status") + if echo $smartstatus | grep -q "OK"; then + color="0 255 0" # Grün + else + color="255 0 0" # Rot + fi $UGREEN_LEDS_CLI disk$disk_number -on -color $color -brightness $brightness > /dev/null 2>&1 done - - # CPU - $UGREEN_LEDS_CLI power -on -color $color -brightness $brightness > /dev/null 2>&1 fi exit 0 \ No newline at end of file