Advertisement
tomycz

disk status

Jan 7th, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # install the smartctl package first! (apt-get install smartctl)
  4.  
  5. if sudo true
  6. then
  7. true
  8. else
  9. echo 'Root jog kell'
  10.  
  11. exit 1
  12. fi
  13.  
  14. for drive in /dev/sd[a-z] /dev/sd[a-z][a-z]
  15. do
  16. if [[ ! -e $drive ]]; then continue ; fi
  17.  
  18. echo -n "$drive "
  19.  
  20. smart=$(
  21. sudo lsblk $drive |
  22. grep 'part' &&
  23. sudo smartctl -a -d sat $drive 2>/dev/null |
  24. grep 'Device Model\|result:\|Reallocated_Sector_Ct\|Current_Pending_Sector\|Raw_Read_Error\|End-to-End\|Supercap_Status\|Temperature_Celsius' |
  25. awk '{ print }'
  26. )
  27.  
  28. [[ "$smart" == "" ]] && smart='unavailable'
  29.  
  30. echo "$smart"
  31. echo "$smart" | mail -s "KODI server DISK STATUS" [email protected]
  32.  
  33. done
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement