#!/bin/sh
#
# $Id: post-diff.sh,v 1.4 2007/08/29 08:18:01 he Exp $
#

cd /tftpboot

CF=${HOME}/.zino-mail
if [ ! -f $CF ]; then
    echo "No $CF file" >&2
    exit 1
fi

. $CF

if test -s last-checked-diff ; then
    (
    echo "To: ${MAILTO}";
    echo "From: ${MAILFROM}";
    echo "Subject: Device config changes `date +%Y-%m-%d`";
    echo "";
    cat last-checked-files last-checked-diff;
    ) | %RAWSENDMAIL% ${MAILTO}

    cat last-checked-files last-checked-diff > last-checked-diff.`date +%a`
    rm -f last-checked-diff
fi
rm -f last-checked-files
