Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Signed-off-by: Mykhailo Kravchuk <michael.ua@gmail.com>
  • Loading branch information
mvk15 authored Oct 11, 2024
1 parent 18fcb1c commit 9202830
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions smartmon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,12 @@ format_output() {
awk -F'{' "${output_format_awk}"
}

smartctl_version="$(/usr/sbin/smartctl -V | head -n1 | awk '$1 == "smartctl" {print $2}')"
smartctl_version="$(/usr/sbin/smartctl -V | awk 'NR==1 && $1 == "smartctl" {print $2}')"

echo "smartctl_version{version=\"${smartctl_version}\"} 1" | format_output

if [[ "$(expr "${smartctl_version}" : '\([0-9]*\)\..*')" -lt 6 ]]; then
exit
fi
# Exit if "smartctl" version is lower 6
[[ ${smartctl_version%.*} -lt 6 ]] && exit 0

device_list="$(/usr/sbin/smartctl --scan-open | awk '/^\/dev/{print $1 "|" $3}')"

Expand Down

0 comments on commit 9202830

Please sign in to comment.