#!/bin/sh
RDATE=`date +%Y%m%d`
MDATE=`date -d "-7 days" +%Y%m%d` #7일전 날짜 출력
Log="/usr/local/scripts/system"
touch $Log
echo To: admin@mail > $Log
echo Subject: $HOSTNAME - System check >> $Log
echo =================================================== >> $Log
echo $HOSTNAME:Disk Usage $RDATE >> $Log
echo =================================================== >> $Log
df -kh >> $Log
echo =================================================== >> $Log
/usr/lib/sendmail -t -oi < $Log && mv $Log $Log_$RDATE && rm -f $Log_$MDATE # 메일발송 후 현재날짜로 파일 변경. 7일전 데이타 삭제