Regenerate disk informations if too old
This commit is contained in:
parent
83f4d52260
commit
30eb210111
|
@ -97,11 +97,13 @@ is_disk_support_smart() {
|
|||
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : is_disk_support_smart func − check if SMART is supported on : ${_disk}."
|
||||
|
||||
## Create or empty previous file
|
||||
true > "${_smarctl_support_result}"
|
||||
## Create or empty previous file only if older than 24h (1440 minutes)
|
||||
regenerate_if_too_old "${_smarctl_support_result}" 1440
|
||||
|
||||
## Grep only "support" lines from disk's informations
|
||||
smartctl -d "${_type}" -i -- "${_disk}" | grep -E "^SMART support is:" -- >> "${_smarctl_support_result}"
|
||||
## Grep only "support" lines from disk's informations only if the file was emptied
|
||||
if test ! -s "${_smarctl_support_result}"; then
|
||||
smartctl -d "${_type}" -i -- "${_disk}" | grep -E "^SMART support is:" -- >> "${_smarctl_support_result}"
|
||||
fi
|
||||
|
||||
## If the file is not empty
|
||||
if test -s "${_smarctl_support_result}"; then
|
||||
|
|
Loading…
Reference in New Issue