Skip to content

Instantly share code, notes, and snippets.

@hensing
Created March 27, 2015 09:16
Show Gist options
  • Save hensing/3d0ff5bd963b410e1286 to your computer and use it in GitHub Desktop.
Save hensing/3d0ff5bd963b410e1286 to your computer and use it in GitHub Desktop.
FreeBSD: show selected smartctl values for each ada device [freebsd, smartctl, zsh]
#!/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