# dmail.sh
#
#! /bin/sh

TARGET="`hostname` disk check"
df >/tmp/df.dmail

echo "========== `hostname` =========="		> /tmp/df.dmail.new

if [ -f /tmp/netdate.log ]
then
	echo "========== netdate =========="	>> /tmp/df.dmail.new
	cat /tmp/netdate.log			>> /tmp/df.dmail.new
fi
if [ -f /tmp/df.dmail.old ]
then
	echo "========== new df =========="	>> /tmp/df.dmail.new
	cat /tmp/df.dmail					>> /tmp/df.dmail.new
	echo "========== old df =========="	>> /tmp/df.dmail.new
	cat /tmp/df.dmail.old				>> /tmp/df.dmail.new

	mail mmika@spd.cs.oki.co.jp -s "$TARGET" < /tmp/df.dmail.new
else
	echo "========== new df =========="	> /tmp/df.dmail.new
	cat /tmp/df.dmail					>> /tmp/df.dmail.new
	mail mmika@spd.cs.oki.co.jp -s "$TARGET" < /tmp/df.dmail.new
fi

mv /tmp/df.dmail /tmp/df.dmail.old

/bin/rm -fr /tmp/df.dmail /tmp/df.dmail.new
