Redirect hdparm + sg_inq errors to according .error files
authorMichael Prokop <mika@grml.org>
Mon, 14 Dec 2015 12:25:23 +0000 (13:25 +0100)
committerMichael Prokop <mika@grml.org>
Mon, 14 Dec 2015 12:25:23 +0000 (13:25 +0100)
sg_inq might raise:

Both SCSI INQUIRY and fetching ATA information failed on /dev/vda

and hdparm might raise:

HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device
HDIO_GET_IDENTITY failed: Inappropriate ioctl for device

This is annoying when running grml-hwinfo under cron, so
let's redirect this output to their according .error files.

grml-hwinfo

index 75567b2..eeabf61 100755 (executable)
@@ -361,7 +361,7 @@ cd "${OUTDIR}" || exit 1
 
       if exectest hdparm ; then
         echo -e "hdparm -iv /dev/${disk}:\n" >> hdparm
-        hdparm -iv "/dev/$disk" >> ./hdparm
+        hdparm -iv "/dev/$disk" >> ./hdparm 2>> ./hdparm.error
         echo -e "\n\n" >> hdparm
       fi
 
@@ -385,7 +385,7 @@ cd "${OUTDIR}" || exit 1
 
       if exectest sg_inq ; then
         echo -e "sg_inq /dev/${disk}:\n" >> sg_inq
-        sg_inq "/dev/$disk" >> ./sg_inq
+        sg_inq "/dev/$disk" >> ./sg_inq 2>> ./sg_inq.error
         echo -e "\n\n" >> sg_inq
       fi