From a82034f2458eb033aaf3d70eb908fbf5acd71f45 Mon Sep 17 00:00:00 2001 From: JDierkse Date: Wed, 21 Jun 2023 12:07:41 +0200 Subject: [PATCH] Update output of check script --- check | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/check b/check index 44e78f4..c787170 100755 --- a/check +++ b/check @@ -47,10 +47,22 @@ CheckIQN() { MOUNTPOINT=$(grep "${BLOCKDEVICE}" /proc/mounts | head -n 1 | cut -d " " -f 2) + echo -n "${IQN}: " + + RETURNCODE=0 if [[ -z "${MOUNTPOINT}" || ! -d "${MOUNTPOINT}" ]]; then - fsck -f ${BLOCKDEVICE} + fsck -f ${BLOCKDEVICE} &> /dev/null + RETURNCODE=$? else - fsck -nf ${BLOCKDEVICE} + fsck -nf ${BLOCKDEVICE} &> /dev/null + RETURNCODE=$? + fi + + if [ "${RETURNCODE}" -ne "0" ]; then + echo "ERROR" + echo " ${BLOCKDEVICE} contains errors, please check the filesystem" + else + echo "OK" fi }