#!/bin/bash
# Find all errors
cat /dev/null >> /root/olderror.out
strings -e l /var/vmware/datarecovery/operations_log.utx | grep -B1 -i "error" | awk -F"$" '{print substr($2,5, 30) substr($3, 9, 100) substr ($6, 17, 30) $8}' > /root/newerror.txt

# Compare new list of all errors to old list of all errors
#if ! diff /root/olderror.out /root/newerror.txt
#then
#diff olderror.out newerror.txt | grep ">"  > /root/diff.out
#err=$(cat /root/diff.out | grep -c ">")
#mv /root/newerror.txt /root/olderror.out -f
# Send email with any errors found
mutt -s "Daily VDR Error Report attached please review" -a /root/newerror.txt tonyb@kembacu.org ryonb@kembacu.org < /dev/null
exit 0