fix for run in infinite loop
This commit is contained in:
parent
3ef9a9376a
commit
4a42ea98fa
@ -8,6 +8,9 @@
|
|||||||
DISK="/dev/sda"
|
DISK="/dev/sda"
|
||||||
|
|
||||||
block=$(sudo smartctl --all $DISK | grep 'Short offline' | head -1 | awk '{print $10}')
|
block=$(sudo smartctl --all $DISK | grep 'Short offline' | head -1 | awk '{print $10}')
|
||||||
|
|
||||||
|
[ -z $block ] && print 'no bad blocks!' && exit 0
|
||||||
|
|
||||||
echo "Fixing: " $block
|
echo "Fixing: " $block
|
||||||
|
|
||||||
sudo hdparm --read-sector $block $DISK
|
sudo hdparm --read-sector $block $DISK
|
||||||
@ -15,7 +18,7 @@ sudo hdparm --repair-sector $block --yes-i-know-what-i-am-doing $DISK
|
|||||||
sudo hdparm --read-sector $block $DISK
|
sudo hdparm --read-sector $block $DISK
|
||||||
|
|
||||||
sudo smartctl -t short $DISK -q errorsonly
|
sudo smartctl -t short $DISK -q errorsonly
|
||||||
|
date
|
||||||
while `sudo smartctl -a $DISK | grep -q 'Self_test_in_progress'`
|
while `sudo smartctl -a $DISK | grep -q 'Self_test_in_progress'`
|
||||||
do
|
do
|
||||||
sleep 1
|
sleep 1
|
||||||
|
Loading…
Reference in New Issue
Block a user