rename duration parameters for expressiveness
add more detailed comments to duration parameters
This commit is contained in:
+22
-22
@@ -225,23 +225,23 @@ get_smart_test_duration() {
|
|||||||
| awk '/'"$1"' self-test routine/{getline; gsub(/\(|\)/, ""); printf $4}'
|
| awk '/'"$1"' self-test routine/{getline; gsub(/\(|\)/, ""); printf $4}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The script initially sleeps for a duration after a test is started.
|
||||||
|
# Afterwards the completion status is repeatedly polled.
|
||||||
|
|
||||||
|
# SMART short test duration
|
||||||
Short_Test_Minutes="$(get_smart_test_duration "Short")"
|
Short_Test_Minutes="$(get_smart_test_duration "Short")"
|
||||||
#printf "Short_Test_Minutes=[%s]\n" ${Short_Test_Minutes}
|
Short_Test_Seconds="$(( Short_Test_Minutes * 60))"
|
||||||
|
|
||||||
|
# SMART extended test duration
|
||||||
Extended_Test_Minutes="$(get_smart_test_duration "Extended")"
|
Extended_Test_Minutes="$(get_smart_test_duration "Extended")"
|
||||||
#printf "Extended_Test_Minutes=[%s]\n" ${Extended_Test_Minutes}
|
Extended_Test_Seconds="$(( Extended_Test_Minutes * 60 ))"
|
||||||
|
|
||||||
Short_Test_Sleep=$((Short_Test_Minutes*60))
|
# Maximum duration the completion status is polled
|
||||||
Extended_Test_Sleep=$((Extended_Test_Minutes*60))
|
|
||||||
|
|
||||||
# Selftest polling timeout interval, in hours
|
|
||||||
Poll_Timeout_Hours=4
|
Poll_Timeout_Hours=4
|
||||||
|
Poll_Timeout_Seconds="$(( Poll_Timeout_Hours * 60 * 60))"
|
||||||
|
|
||||||
# Calculate the selftest polling timeout interval in seconds
|
# Sleep interval between completion status polls
|
||||||
Poll_Timeout=$((Poll_Timeout_Hours*60*60))
|
Poll_Interval_Seconds=15
|
||||||
|
|
||||||
# Polling sleep interval, in seconds:
|
|
||||||
Poll_Interval=15
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
@@ -286,12 +286,12 @@ poll_selftest_complete()
|
|||||||
l_rv=0
|
l_rv=0
|
||||||
l_done=1
|
l_done=1
|
||||||
else
|
else
|
||||||
if [ $l_pollduration -ge "${Poll_Timeout}" ]; then
|
if [ $l_pollduration -ge "${Poll_Timeout_Seconds}" ]; then
|
||||||
echo_str "Timeout polling for SMART self-test status"
|
echo_str "Timeout polling for SMART self-test status"
|
||||||
l_done=1
|
l_done=1
|
||||||
else
|
else
|
||||||
sleep ${Poll_Interval}
|
sleep ${Poll_Interval_Seconds}
|
||||||
l_pollduration=$((l_pollduration+Poll_Interval))
|
l_pollduration=$((l_pollduration+Poll_Interval_Seconds))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -307,12 +307,12 @@ run_short_test()
|
|||||||
push_header
|
push_header
|
||||||
if [ "${Dry_Run}" -eq 0 ]; then
|
if [ "${Dry_Run}" -eq 0 ]; then
|
||||||
smartctl -t short /dev/"$Drive"
|
smartctl -t short /dev/"$Drive"
|
||||||
echo_str "Short test started, sleeping ${Short_Test_Sleep} seconds until it finishes"
|
echo_str "Short test started, sleeping ${Short_Test_Seconds} seconds until it finishes"
|
||||||
sleep ${Short_Test_Sleep}
|
sleep ${Short_Test_Seconds}
|
||||||
poll_selftest_complete
|
poll_selftest_complete
|
||||||
smartctl -l selftest /dev/"$Drive" | tee -a "$Log_File"
|
smartctl -l selftest /dev/"$Drive" | tee -a "$Log_File"
|
||||||
else
|
else
|
||||||
echo_str "Dry run: would start the SMART short test and sleep ${Short_Test_Sleep} seconds until the test finishes"
|
echo_str "Dry run: would start the SMART short test and sleep ${Short_Test_Seconds} seconds until the test finishes"
|
||||||
fi
|
fi
|
||||||
echo_str "Finished SMART short test on drive /dev/${Drive}: $(date)"
|
echo_str "Finished SMART short test on drive /dev/${Drive}: $(date)"
|
||||||
}
|
}
|
||||||
@@ -324,12 +324,12 @@ run_extended_test()
|
|||||||
push_header
|
push_header
|
||||||
if [ "${Dry_Run}" -eq 0 ]; then
|
if [ "${Dry_Run}" -eq 0 ]; then
|
||||||
smartctl -t long /dev/"$Drive"
|
smartctl -t long /dev/"$Drive"
|
||||||
echo_str "Extended test started, sleeping ${Extended_Test_Sleep} seconds until it finishes"
|
echo_str "Extended test started, sleeping ${Extended_Test_Seconds} seconds until it finishes"
|
||||||
sleep ${Extended_Test_Sleep}
|
sleep ${Extended_Test_Seconds}
|
||||||
poll_selftest_complete
|
poll_selftest_complete
|
||||||
smartctl -l selftest /dev/"$Drive" | tee -a "$Log_File"
|
smartctl -l selftest /dev/"$Drive" | tee -a "$Log_File"
|
||||||
else
|
else
|
||||||
echo_str "Dry run: would start the SMART extended test and sleep ${Extended_Test_Sleep} seconds until the test finishes"
|
echo_str "Dry run: would start the SMART extended test and sleep ${Extended_Test_Seconds} seconds until the test finishes"
|
||||||
fi
|
fi
|
||||||
echo_str "Finished SMART extended test on drive /dev/${Drive}: $(date)"
|
echo_str "Finished SMART extended test on drive /dev/${Drive}: $(date)"
|
||||||
}
|
}
|
||||||
@@ -368,9 +368,9 @@ echo_str "Host: $(hostname)"
|
|||||||
echo_str "Drive Model: ${Disk_Model}"
|
echo_str "Drive Model: ${Disk_Model}"
|
||||||
echo_str "Serial Number: ${Serial_Number}"
|
echo_str "Serial Number: ${Serial_Number}"
|
||||||
echo_str "Short test duration: ${Short_Test_Minutes} minutes"
|
echo_str "Short test duration: ${Short_Test_Minutes} minutes"
|
||||||
echo_str "Short test sleep duration: ${Short_Test_Sleep} seconds"
|
echo_str "Short test sleep duration: ${Short_Test_Seconds} seconds"
|
||||||
echo_str "Extended test duration: ${Extended_Test_Minutes} minutes"
|
echo_str "Extended test duration: ${Extended_Test_Minutes} minutes"
|
||||||
echo_str "Extended test sleep duration: ${Extended_Test_Sleep} seconds"
|
echo_str "Extended test sleep duration: ${Extended_Test_Seconds} seconds"
|
||||||
echo_str "Log file: ${Log_File}"
|
echo_str "Log file: ${Log_File}"
|
||||||
echo_str "Bad blocks file: ${BB_File}"
|
echo_str "Bad blocks file: ${BB_File}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user