
#!/bin/sh
# File	: proc_dd-autosupports.sh
# By	: Maarten.deBoer@atos.net
# Subject	: Script to process DataDomains autosupport messages
PGM=`basename $0|cut -d\. -f1`
VER="0.1"
TMP="/tmp/${PGM}.$$"
BASEDIR="/appl/data/datadomain"
LOG="${BASEDIR}/log/${PGM}.log"

INDIR="${BASEDIR}/input"

echo "`date` ${PGM} v${VER} started."|tee -a ${LOG}
touch ${TMP}


ls -1 ${INDIR}|while read FNAME REST1
do
  echo "  ${FNAME}"
  DRIVES=`grep "drives present" ${INDIR}/${FNAME}|awk '{print $1}'`
  LINES=`expr ${DRIVES} + 8`

  SSD=`grep -B ${LINES} "drives present" ${INDIR}/${FNAME}|grep "SSD"|wc -l`
  HDD=`grep -B ${LINES} "drives present" ${INDIR}/${FNAME}|egrep "SAS|SATA"|grep -v SSD |wc -l`

  echo "    ${DRIVES} drives (${LINES} lines). ${SSD} SSD, ${HDD} HDD"

done  # ls -1


rm ${TMP}
echo "`date` ${PGM} v${VER} finished."|tee -a ${LOG}
exit 0

