mirror of
https://github.com/Spearfoot/disk-burnin-and-testing.git
synced 2026-11-29 19:36:26 -05:00
Merge 09260e5d5a into 8d1d38324f
This commit is contained in:
commit
8610be4fe0
1 changed files with 14 additions and 13 deletions
|
|
@ -333,13 +333,13 @@ readonly SMART_CAPABILITIES="$(smartctl --capabilities "${DRIVE}")"
|
|||
# Write value to stdout.
|
||||
##################################################
|
||||
get_smart_info_value() {
|
||||
# $1=$2=""; select all but first two columns
|
||||
# gsub(/^.*?:/, ""); discard everything until first colon
|
||||
# gsub(/^[ \t]+|[ \t]+$/, ""); replace leading and trailing whitespace
|
||||
# gsub(/ /, "_"); replace remaining spaces with underscores
|
||||
# printf $1 print result without newline at the end
|
||||
printf '%s' "${SMART_INFO}" \
|
||||
| grep "$1" \
|
||||
| awk '{$1=$2=""; gsub(/^[ \t]+|[ \t]+$/, ""); gsub(/ /, "_"); printf $1}'
|
||||
| grep -i "$1" \
|
||||
| awk '{gsub(/^.*?:/, ""); gsub(/^[ \t]+|[ \t]+$/, ""); gsub(/ /, "_"); printf $1}'
|
||||
}
|
||||
|
||||
##################################################
|
||||
|
|
@ -364,9 +364,10 @@ get_smart_test_duration() {
|
|||
}
|
||||
|
||||
# Get disk model
|
||||
DISK_MODEL="$(get_smart_info_value "Device Model")"
|
||||
[ -z "${DISK_MODEL}" ] && DISK_MODEL="$(get_smart_info_value "Model Family")"
|
||||
[ -z "${DISK_MODEL}" ] && DISK_MODEL="$(get_smart_info_value "Model Number")"
|
||||
DISK_MODEL="$(get_smart_info_value "Device Model:")"
|
||||
[ -z "${DISK_MODEL}" ] && DISK_MODEL="$(get_smart_info_value "Model Family:")"
|
||||
[ -z "${DISK_MODEL}" ] && DISK_MODEL="$(get_smart_info_value "Model Number:")"
|
||||
[ -z "${DISK_MODEL}" ] && DISK_MODEL="$(get_smart_info_value "Product:")"
|
||||
readonly DISK_MODEL
|
||||
|
||||
# Get disk type; unless we get 'Solid State Device' as return value, assume
|
||||
|
|
@ -531,13 +532,6 @@ log_runtime_info() {
|
|||
poll_selftest_complete() {
|
||||
l_poll_duration_seconds=0
|
||||
while [ "${l_poll_duration_seconds}" -lt "${POLL_TIMEOUT_SECONDS}" ]; do
|
||||
smartctl --all "${DRIVE}" \
|
||||
| grep -i "The previous self-test routine completed" > /dev/null 2>&1
|
||||
l_status="$?"
|
||||
if [ "${l_status}" -eq 0 ]; then
|
||||
log_info "SMART self-test succeeded"
|
||||
return 0
|
||||
fi
|
||||
smartctl --all "${DRIVE}" \
|
||||
| grep -i "of the test failed\." > /dev/null 2>&1
|
||||
l_status="$?"
|
||||
|
|
@ -545,6 +539,13 @@ poll_selftest_complete() {
|
|||
log_info "SMART self-test failed"
|
||||
return 0
|
||||
fi
|
||||
smartctl --all "${DRIVE}" \
|
||||
| grep -E "Self-test execution status:.*(progress|remaining)" > /dev/null 2>&1
|
||||
l_status="$?"
|
||||
if [ "${l_status}" -ne 0 ]; then
|
||||
log_info "SMART self-test succeeded"
|
||||
return 0
|
||||
fi
|
||||
sleep "${POLL_INTERVAL_SECONDS}"
|
||||
l_poll_duration_seconds="$(( l_poll_duration_seconds + POLL_INTERVAL_SECONDS ))"
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue