diff --git a/smart.run.test.sh b/smart.run.test.sh index d53117c..2e4aa44 100755 --- a/smart.run.test.sh +++ b/smart.run.test.sh @@ -149,28 +149,31 @@ choose_correct_type() { } ## ]]] +# Get the arguments's list and check values manage_arguments "${@}" -# Create files +# Create file true > "${smart_device_list}" # Get the list of all available devices smartctl --scan >> "${smart_device_list}" +# If the devices list is not empty if test -s "${smart_device_list}"; then while IFS= read -r LINE; do ## Get device path disk_path=$(echo "${LINE}" | cut -d" " -f1) - ## Try to determine the best type + ## Get scanned type scanned_disk_type=$(echo "${LINE}" | cut -d" " -f3) [ "${debug}" -eq "0" ] && printf "\n${c_magentab}%-6b${c_reset}\n" "DEBUG : smartctl scan ${disk_path} with TYPE ${scanned_disk_type}." + ## Try to determine the best type choose_correct_type "${disk_path}" "${scanned_disk_type}" ## If no correct type was found for this device if [ -z "${disk_type}" ]; then [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : SMART is not fully supported on ${disk_path}." else - [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : for disk ${disk_path}, now use TYPE ${disk_type}." + [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : Run a ${test_to_run} SMART test on disk ${disk_path}, with ${disk_type} TYPE." fi done < "${smart_device_list}"