Regenerate disk informations if too old

This commit is contained in:
Jeremy Gardais 2020-03-11 11:31:43 +01:00
parent 83f4d52260
commit 30eb210111
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 6 additions and 4 deletions

View File

@ -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
## 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