
#!/bin/sh
# File	: get_snapmirror_update_times.sh
# By	: Maarten.deBoer@Atos.net, 120120
PGM="`basename $0|cut -d\. -f1`"
TMP="/tmp/${PGM}.$$"
FILERS="${HOME}/etc/filers"
SSH="/usr/bin/ssh -n"
MAILTO="maarten.deboer@atos.net"
FILTER="[1234567890]*"

#FILTER="slb"

echo "# Filer;Source;Destination;Arg.;minute;hour;day-of-month;day-of-week;" > ${TMP}
for FILER in `cat ${FILERS}|grep -v \^#`
do
  echo "${FILER} ;" |tee -a ${TMP}
  ${SSH} ${FILER} rdfile /etc/snapmirror.conf|grep -v \^#|grep ${FILTER}| awk '{print ";"$1";"$2";"$3";"$4";"$5";"$6";"$7";"$8";"}' >> ${TMP}
done

cat ${TMP}|uuencode ${PGM}.csv|mailx -s "SnapMirror-update-times-${FILTER}.csv" ${MAILTO}

echo "Mailed to ${MAILTO} (with FILTER=${FILTER}) ."

rm ${TMP}
exit 0

