Created
June 19, 2018 07:43
-
-
Save silv3rr/8ef867699640c74bd333413e80d2aea2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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