common: smart.sh - sort failure messages
authorDavid Galloway <dgallowa@redhat.com>
Wed, 25 Nov 2020 15:02:58 +0000 (10:02 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 25 Nov 2020 15:25:27 +0000 (10:25 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/common/files/libexec/smart.sh

index 332f36478801266ea0821eb970d86ed341e77432..2287a1d49a823967b4d5402a7e3315231e0736b2 100755 (executable)
@@ -70,8 +70,8 @@ main ()
   # Nagios reads and displays the first line of output on the Services page.
   # All individual messages about failed/failing disk statistics can be viewed
   # on the individual system's SMART detail page in nagios.
-  for msg in "${messages[@]}"
-  do
+  readarray -t sorted < <(for msg in "${messages[@]}"; do echo "$msg"; done | sort)
+  for msg in "${sorted[@]}"; do
     echo "$msg"
   done