#!/bin/bash
PATH=/bin:/usr/bin
export PATH
CheckDir="/etc /bin /sbin /boot"
Mail="steven@eic.com.tw"
WARN="";

for i in `find $CheckDir` 
do
	if [ `lsattr -d $i | awk '{print $1}'` != "-------------" ]; then
		WARN=${WARN}"$i \n"
	fi
done
if [ "$WARN" != "" ]; then
	echo -e "$WARN" > /tmp/attrw.log
	mail -s "Mail & DNS: Attribute Warning!" $Mail < /tmp/attrw.log
	rm -f /tmp/attrw.log
fi
