January 15, 200917 yr Hey guys, Jo's smarttest script i downloaded doesnt seem to create a report for all my drives, but only one of them..... When i run the cmd: sh smarttest.sh it creates the smart results directory, and has a log in there for my IDE HDD (first device).....i have 2 other SATA HDD's that it didnt make a report for though....in the forum thread it says itll create a report for all of them....any help would be much appreciated Thanks:) heres where i d/l the script from: http://lime-technology.com/forum/index.php?topic=2135.15 ....down the middle of the page, theres a link to smarttest.zip
January 15, 200917 yr Hey guys, Jo's smarttest script i downloaded doesnt seem to create a report for all my drives, but only one of them..... When i run the cmd: sh smarttest.sh it creates the smart results directory, and has a log in there for my IDE HDD (first device).....i have 2 other SATA HDD's that it didnt make a report for though....in the forum thread it says itll create a report for all of them....any help would be much appreciated Thanks:) heres where i d/l the script from: http://lime-technology.com/forum/index.php?topic=2135.15 ....down the middle of the page, theres a link to smarttest.zip That script was written before SATA drive showed themselves as "scsi" in most hardware. I'll update it, as it will miss newer SATA drives in my array too. Joe L.
January 15, 200917 yr Author Makes sense why my old IDE HDD works fine and the other 2 sata hdd's i have don't work Thanks - cant wait:)
January 15, 200917 yr Makes sense why my old IDE HDD works fine and the other 2 sata hdd's i have don't work Thanks - cant wait:) Quick fix, if you are up to editing the script is to delete the three lines highlighted in red below. It is causing the disks with "scsi" as the leading part of their name to be excluded. As we NOW know, many SATA drive controllers identify themselves as "scsi" to the Linux OS. When I wrote the script I "knew" that "scsi" drives would never support SMART commands, so I excluded them.... case $i in usb*) continue ;; scsi*) continue ;; *part[1-9]) continue ;; If you do edit the script, do it with an editor that does not add Carriage-Returns, or process the script through "fromdos" otherwise. Joe L.
January 16, 200917 yr Author Hey - i removed the lines in Red from Wordpad in xp, and it doesnt recognise the command anymore Here' what my script looks like now: #!/bin/bash SMART_RESULTS_DIR=/boot/smart_results if [ ! -d $SMART_RESULTS_DIR ] then mkdir $SMART_RESULTS_DIR fi dt=`date "+%Y%m%d"` ls -l /dev/disk/by-id | while read a b c d e f g h i j k do case $i in usb*) continue ;; *part[1-9]) continue ;; ata*) disk_device=`echo $k | cut -c7-` disk_serial=`echo $i | sed -n "s/\(ata-\)\(.*\)_\([^_]*\)/\3/p"` disk_model=`echo $i | sed -n "s/\(ata-\)\(.*\)_\([^_]*\)/\2/p"` dms=${disk_model}_${disk_serial} # if a subdirecctory for the serial number does not exist, create it if [ ! -d $SMART_RESULTS_DIR/$disk_serial ] then mkdir $SMART_RESULTS_DIR/$disk_serial fi echo "Testing ${disk_device} ${disk_model} ${disk_serial}" echo "TEST for $dms on $dt" >$SMART_RESULTS_DIR/$disk_serial/smart_${dt}_$dms.txt smartctl -a -d ata /dev/$disk_device >>$SMART_RESULTS_DIR/$disk_serial/smart_${dt}_$dms.txt ;; esac done cat $SMART_RESULTS_DIR/*/smart_${dt}_* >$SMART_RESULTS_DIR/${dt}_smart_summary.txt echo "Smart Summary is in $SMART_RESULTS_DIR/${dt}_smart_summary.txt" ...............And here's my error: root@Media:/boot# sh 1.sh '.sh: line 10: syntax error near unexpected token `in '.sh: line 10: ` case $i in
January 17, 200917 yr I guess you missed this: If you do edit the script, do it with an editor that does not add Carriage-Returns, or process the script through "fromdos" otherwise. Before you do anything, try cat -v 1.sh (I'm assuming you made a copy named "1.sh" as that is the name you showed in your error message) I'll bet there are carriage return characters in there.... (They will show as "^M" at the ends of lines when using cat -v) Try running fromdos 1.sh and then see if that fixes it. Joe L.
January 17, 200917 yr Author Got the script working after removing lines....still only reports the HDA ide hdd, no sata hdd reports:(....heres my script running throuhg cat -v, and sh smarttest.sh (renamed) root@Media:/boot# cat -v smarttest.sh #!/bin/bash SMART_RESULTS_DIR=/boot/smart_results if [ ! -d $SMART_RESULTS_DIR ] then mkdir $SMART_RESULTS_DIR fi dt=`date "+%Y%m%d"` ls -l /dev/disk/by-id | while read a b c d e f g h i j k do case $i in usb*) continue ;; *part[1-9]) continue ;; ata*) disk_device=`echo $k | cut -c7-` disk_serial=`echo $i | sed -n "s/\(ata-\)\(.*\)_\([^_]*\)/\3/p"` disk_model=`echo $i | sed -n "s/\(ata-\)\(.*\)_\([^_]*\)/\2/p"` dms=${disk_model}_${disk_serial} # if a subdirecctory for the serial number does not exist, create it if [ ! -d $SMART_RESULTS_DIR/$disk_serial ] then mkdir $SMART_RESULTS_DIR/$disk_serial fi echo "Testing ${disk_device} ${disk_model} ${disk_serial}" echo "TEST for $dms on $dt" >$SMART_RESULTS_DIR/$disk_serial/smart_${dt}_$dms.txt smartctl -a -d ata /dev/$disk_device >>$SMART_RESULTS_DIR/$disk_serial/smart_${dt}_$dms.txt ;; esac done cat $SMART_RESULTS_DIR/*/smart_${dt}_* >$SMART_RESULTS_DIR/${dt}_smart_summary.txt echo "Smart Summary is in $SMART_RESULTS_DIR/${dt}_smart_summary.txt" root@Media:/boot# sh smarttest.sh Testing hda ST3500630A 6QG1P3L9 Smart Summary is in /boot/smart_results/20090117_smart_summary.txt root@Media:/boot#
Archived
This topic is now archived and is closed to further replies.