Advertisement
Confusias

Quick Drive Test

Jun 29th, 2020
1,316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.87 KB | None | 0 0
  1. #!/bin/sh
  2. echo "drivetest="
  3.  
  4. DRIVES=`fdisk -l | grep "Disk /dev" | gawk -F' '  '{ print $2 }'`
  5. COMMANDS=(      'smartctl -i DRIVE | grep Serial'
  6.                 'smartctl -a DRIVE | grep Power_On_Hours'
  7.                 'smartctl -a DRIVE | grep Temperature_Celsius'
  8.                 'smartctl -a DRIVE | grep Reallocated_Sector_ct'
  9.                 'smartctl -a DRIVE | grep Reallocated_Event_Count'
  10.                 'smartctl -a DRIVE | grep Current_Pending_Sector'
  11.                 'smartctl -a DRIVE | grep Offline_Uncorrectable'
  12.                 'smartctl -H DRIVE | grep result'
  13.         )
  14.  
  15. for i in $(echo $DRIVES | tr ":" "\n")
  16. do
  17. #       NUMBER=$[ ( $RANDOM % 100 )  + 1 ]
  18. #       echo "&${NUMBER}=PROCESSING NEW DRIVE"
  19.  
  20.         for c in "${COMMANDS[@]}"
  21.         do
  22.                 NEWCOMMAND=${c//'DRIVE'/$i}
  23.                 eval "$NEWCOMMAND"
  24.         done
  25. # done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement