Manage case of scan doesn't return any result
This commit is contained in:
parent
3258881a0f
commit
5ec0d0c8ee
|
@ -87,8 +87,8 @@ if test -f /tmp/dscan; then rm -f -- /tmp/dscan; fi
|
||||||
smartctl --scan > /tmp/dscan
|
smartctl --scan > /tmp/dscan
|
||||||
|
|
||||||
# TODO: Test if the file is not empty
|
# TODO: Test if the file is not empty
|
||||||
|
if test -s /tmp/dscan; then
|
||||||
while IFS= read -r LINE; do
|
while IFS= read -r LINE; do
|
||||||
## Get device path
|
## Get device path
|
||||||
DISK=$(echo "${LINE}" | cut -d" " -f1)
|
DISK=$(echo "${LINE}" | cut -d" " -f1)
|
||||||
## Try to determine the best type
|
## Try to determine the best type
|
||||||
|
@ -136,7 +136,11 @@ while IFS= read -r LINE; do
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
} >>/tmp/dres
|
} >>/tmp/dres
|
||||||
done < /tmp/dscan >/tmp/dcheck
|
done < /tmp/dscan > /tmp/dcheck
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "1&red Error while scanning devices with smartctl" > /tmp/dcheck
|
||||||
|
fi
|
||||||
|
|
||||||
# Set the global color according to the highest alert
|
# Set the global color according to the highest alert
|
||||||
COLOR=$(< /tmp/dcheck awk '{print $1}' | sort | uniq | head -1 | cut -c3-)
|
COLOR=$(< /tmp/dcheck awk '{print $1}' | sort | uniq | head -1 | cut -c3-)
|
||||||
|
|
Loading…
Reference in New Issue