-
Notifications
You must be signed in to change notification settings - Fork 2
/
smart.sh
39 lines (27 loc) · 954 Bytes
/
smart.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Script by Meliorator. irc://irc.freenode.net/Meliorator
# modified by Ranpha & AntoninGP
. main.conf
[ ! "$@" ] && echo "Usage: $0 type [type] [type]"
a=0
for t in "$@"; do
case "$t" in
offline) l=error;;
short|long) l=selftest;;
*) echo $t is an unrecognised test type. Skipping... && continue
esac
for hd in /dev/disk/by-id/ata*; do
r=$(( $(smartctl -t $t -d ata $hd | grep 'Please wait' | awk '{print $3}') ))
echo Check $hd - $t test in $r minutes
[ $r -gt $a ] && a=$r
done
echo "Waiting $a minutes for all tests to complete"
sleep $(($a))m
for hd in /dev/disk/by-id/ata*; do
smartctl -l $l -d ata $hd 2>&1 >> $logpath/smart-${t}-${hd##*/}.log
done
done
for i in {1..10}; do
sleep .01
echo -n -e \\a
done
echo "All tests have completed"