mirror of
https://github.com/Spearfoot/FreeNAS-scripts
synced 2025-12-17 00:33:28 +00:00
Consistent if and do code formatting
This commit is contained in:
@@ -37,13 +37,12 @@ get_smart_drives()
|
|||||||
|
|
||||||
gs_smartdrives=""
|
gs_smartdrives=""
|
||||||
|
|
||||||
for gs_drive in $gs_drives
|
for gs_drive in $gs_drives; do
|
||||||
do
|
gs_smart_flag=$(/usr/local/sbin/smartctl -i /dev/"$gs_drive" | grep "SMART support is: Enabled" | awk '{print $4}')
|
||||||
gs_smart_flag=$(/usr/local/sbin/smartctl -i /dev/"$gs_drive" | grep "SMART support is: Enabled" | awk '{print $4}')
|
if [ "$gs_smart_flag" == "Enabled" ]; then
|
||||||
if [ "$gs_smart_flag" == "Enabled" ]; then
|
gs_smartdrives=$gs_smartdrives" "${gs_drive}
|
||||||
gs_smartdrives=$gs_smartdrives" "${gs_drive}
|
fi
|
||||||
fi
|
done
|
||||||
done
|
|
||||||
|
|
||||||
eval "$1=\$gs_smartdrives"
|
eval "$1=\$gs_smartdrives"
|
||||||
}
|
}
|
||||||
@@ -76,8 +75,7 @@ echo "<pre style=\"font-size:14px\">" >> ${logfile}
|
|||||||
echo "+------+------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+"
|
echo "+------+------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+"
|
||||||
) >> ${logfile}
|
) >> ${logfile}
|
||||||
|
|
||||||
for drive in $drives
|
for drive in $drives; do
|
||||||
do
|
|
||||||
(
|
(
|
||||||
/usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/"${drive}" | \
|
/usr/local/sbin/smartctl -A -i -v 7,hex48 /dev/"${drive}" | \
|
||||||
awk -v device="${drive}" -v tempWarn=${tempWarn} -v tempCrit=${tempCrit} -v sectorsCrit=${sectorsCrit} \
|
awk -v device="${drive}" -v tempWarn=${tempWarn} -v tempCrit=${tempCrit} -v sectorsCrit=${sectorsCrit} \
|
||||||
@@ -111,18 +109,16 @@ for drive in $drives
|
|||||||
seekErrors, totalSeeks, hiFlyWr, cmdTimeout;
|
seekErrors, totalSeeks, hiFlyWr, cmdTimeout;
|
||||||
}'
|
}'
|
||||||
) >> ${logfile}
|
) >> ${logfile}
|
||||||
done
|
done
|
||||||
|
|
||||||
(
|
(
|
||||||
echo "+------+------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+"
|
echo "+------+------------------+----+-----+-----+-----+-------+-------+--------+------+----------+------+-------+"
|
||||||
) >> ${logfile}
|
) >> ${logfile}
|
||||||
|
|
||||||
###### for each drive ######
|
###### for each drive ######
|
||||||
for drive in $drives
|
for drive in $drives; do
|
||||||
do
|
|
||||||
brand=$(/usr/local/sbin/smartctl -i /dev/"${drive}" | grep "Model Family" | awk '{print $3, $4, $5}')
|
brand=$(/usr/local/sbin/smartctl -i /dev/"${drive}" | grep "Model Family" | awk '{print $3, $4, $5}')
|
||||||
if [ -z "$brand" ];
|
if [ -z "$brand" ]; then
|
||||||
then
|
|
||||||
brand=$(/usr/local/sbin/smartctl -i /dev/"${drive}" | grep "Device Model" | awk '{print $3, $4, $5}')
|
brand=$(/usr/local/sbin/smartctl -i /dev/"${drive}" | grep "Device Model" | awk '{print $3, $4, $5}')
|
||||||
fi
|
fi
|
||||||
serial=$(/usr/local/sbin/smartctl -i /dev/"${drive}" | grep "Serial Number" | awk '{print $3}')
|
serial=$(/usr/local/sbin/smartctl -i /dev/"${drive}" | grep "Serial Number" | awk '{print $3}')
|
||||||
|
|||||||
Reference in New Issue
Block a user