Add smart-scan.sh
This commit is contained in:
commit
aca9d2c4ba
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This bash script requires smartctl
|
||||
|
||||
date=$(date -u +%Y-%m-%d--%H:%M)
|
||||
|
||||
if sudo true
|
||||
then
|
||||
true
|
||||
else
|
||||
echo 'Root privileges required'
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for drive in /dev/sd[a-z] /dev/sd[a-z][a-z] /dev/nvme[0-9]n[0-9]
|
||||
do
|
||||
if [[ ! -e $drive ]]; then continue ; fi
|
||||
|
||||
echo -n "$drive "
|
||||
echo -e "\n"
|
||||
|
||||
smart=$(
|
||||
sudo smartctl -i $drive |grep Serial
|
||||
sudo smartctl -A $drive |grep -E "^ "9"" |awk -F" " '{ print $2,$10 }'
|
||||
sudo smartctl -A $drive |grep -E "^ "5"" |awk -F" " '{ print $2,$10 }'
|
||||
sudo smartctl -A $drive |grep -E "Current_Pending_Sector" |awk -F" " '{ print $2,$10 }'
|
||||
sudo smartctl -A $drive |grep -E "Offline_Uncorrectable" |awk -F" " '{ print $2,$10 }'
|
||||
)
|
||||
|
||||
echo -e "$smart\n"
|
||||
|
||||
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue