Skip to content

Instantly share code, notes, and snippets.

@silv3rr
Created June 19, 2018 07:43
Show Gist options
  • Save silv3rr/8ef867699640c74bd333413e80d2aea2 to your computer and use it in GitHub Desktop.
Save silv3rr/8ef867699640c74bd333413e80d2aea2 to your computer and use it in GitHub Desktop.
#!/bin/sh
#sg=2
if [ "$USER" != "root" ]; then echo "[ERROR] You are not root."; exit 1; fi
if [ -z "$sg" ]; then sg=0; fi
for i in $( seq "$sg" 3 ); do
for j in $( seq 1 28 ); do
res="$( smartctl -d areca,"$j" -a "/dev/sg${i}" | \
grep -Ei "model|serial|result|capacity" | \
sed -Ee 's/ Number|User Capacity| [0-9].*bytes//g' \
-e 's/SMART overall-health self-assessment test result://g' )"
if [ ! -z "$res" ]; then printf "%s: %s\n" "$j" "$( echo $res )"; fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment