Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # $1=device(sda/sdb), $2=type(ssd/hdd)
- function fn_run_smartcheck () {
- SMART_LOGFILE=$BCKP_DATA/healthcheck_$2_$1_$(date +%Y-%m-%d).txt
- sudo smartctl -t short -a /dev/$1 > $SMART_LOGFILE
- if [[ $2 == "ssd" ]]; then fn_print_results_ssd $1; fi
- if [[ $2 == "hdd" ]]; then fn_print_results_hdd $1; fi
- echo
- echo
- }
- # $1=device(sda/sdb)
- function fn_print_results_ssd () {
- echo "=> SSD-Life Overview:"
- cat $SMART_LOGFILE | \
- grep "Device Model:\|Rotation Rate:\|Form Factor:\|overall-health"
- echo
- cat $SMART_LOGFILE | \
- grep "ID#\|Raw_Read_Error_Rate\|Reallocated_Sector_Ct\|Power_On_Hours\|Power_Cycle_Count"
- cat $SMART_LOGFILE | \
- grep "Temperature_Celsius\|Total_LBAs_Written\|Total_LBAs_Read"
- }
- # $1=device(sda/sdb)
- function fn_print_results_hdd () {
- echo "=> HDD-Life Overview:"
- cat $SMART_LOGFILE | \
- grep "Device Model:\|Rotation Rate:\|Form Factor:\|overall-health"
- echo
- cat $SMART_LOGFILE | \
- grep "ID#\|Raw_Read_Error_Rate\|Spin_Up_Time\|Start_Stop_Count"
- cat $SMART_LOGFILE | \
- grep "Reallocated_Sector_Ct\|Power_On_Hours\|Power_Cycle_Count\|Temperature_Celsius"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement