From owner-freebsd-hackers Sun Aug 22 1:12:24 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from metriclient-1.uoregon.edu (metriclient-1.uoregon.edu [128.223.172.1]) by hub.freebsd.org (Postfix) with ESMTP id 1634714C45 for ; Sun, 22 Aug 1999 01:12:19 -0700 (PDT) (envelope-from gurney_j@efn.org) Received: (from jmg@localhost) by metriclient-1.uoregon.edu (8.9.1/8.8.7) id BAA07656; Sun, 22 Aug 1999 01:12:19 -0700 (PDT) Message-ID: <19990822011218.60743@hydrogen.fircrest.net> Date: Sun, 22 Aug 1999 01:12:18 -0700 From: John-Mark Gurney To: hackers@freebsd.org Subject: watching defects on scsi disks... Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.69 Reply-To: John-Mark Gurney Organization: Cu Networking X-Operating-System: FreeBSD 3.0-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I was wondering if someone would like to clean up a bit of shell scripting I wrote to attach a report of the defect list to the daily output... it works great so far and thought I might as well share this w/ the rest of people... once it gets cleaned up, I have no problems w/ committing it to the tree, it's just kinda ugly right now... bak=/var/backups echo "" echo "" echo "checking disks for defects:" for i in `camcontrol devlist | awk '/(da|sd)/ { if (match($0, "(da|sd)[[:digit:]]+") != 0) { diskname = substr($0, RSTART, RLENGTH); match(diskname, "[[:digit:]]+"); print substr(diskname, RSTART, RLENGTH) } }' | sort -u`; do if [ -f ${bak}/da${i}.glist ]; then mv ${bak}/da${i}.glist ${bak}/da${i}.glist.bak fi echo -n "da${i}: " camcontrol defects -u $i -f phys -G 2>&1 > ${bak}/da${i}.glist if [ -f ${bak}/da${i}.glist.bak ]; then if ! cmp -s ${bak}/da${i}.glist ${bak}/da${i}.glist.bak; then diff ${bak}/da${i}.glist.bak ${bak}/da${i}.glist fi fi done -- John-Mark Gurney Voice: +1 541 684 8449 Cu Networking P.O. Box 5693, 97405 "The soul contains in itself the event that shall presently befall it. The event is only the actualizing of its thought." -- Ralph Waldo Emerson To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message