Created
March 27, 2015 09:16
-
-
Save hensing/3d0ff5bd963b410e1286 to your computer and use it in GitHub Desktop.
FreeBSD: show selected smartctl values for each ada device [freebsd, smartctl, zsh]
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
#!/usr/bin/env zsh | |
# | |
# gets all ada devices and prints selected smartctl values for all devices | |
# | |
# by H.Dickten 2015 | |
# get ada devices | |
ADA=`sudo camcontrol devlist |grep ada| cut -d "(" -f 2 |cut -d ',' -f 1|xargs` | |
# get array from ada list | |
ADA_ARR=("${(@s/ /)ADA}") | |
# print values | |
for (( i=1; i <= $#ADA_ARR; i++ )) | |
do | |
echo $ADA_ARR[i] | |
sudo smartctl -a /dev/$ADA_ARR[i] |grep -E '^( 4| 5| 7| 12|193|196)' | |
echo "" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment