
#!/bin/sh
# File	: mail-status.sh
# By	: MaartenDeBoer.nl, 161220
# Subject	: Scripts to mail the status
#(0.2)	: Mod. DF-H & add FINGER
PGM="`basename $0|cut -d\. -f1`"
VER="0.2"
TMP="/tmp/${PGM}.$$"
LOG="${HOME}/log/${PGM}.log"
HOSTNAME="`hostname|cut -d\. -f1`"
MAILTO="maarten@agrarix.net"

touch ${TMP}
echo "HOSTNAME=`hostname`" >> ${TMP}
echo "UPTIME=`uptime`" >> ${TMP}
echo "<FINGER>" >> ${TMP}
echo "`/usr/bin/finger`" >> ${TMP}
echo "</FINGER>" >> ${TMP}
echo "<DF-H>" >> ${TMP}
echo "`df -h`" >> ${TMP}
echo "</DF-H>" >> ${TMP}
echo "DATISTRUTC=`date +%Y%m%d%H%M%S --utc`" >> ${TMP}
echo "UNAME-R=`/usr/bin/uname -r`" >> ${TMP}
echo "UNAME-V=`/usr/bin/uname -v`" >> ${TMP}
echo "DMESG-MODEL=`/usr/bin/dmesg|grep model|head -1`" >> ${TMP}
echo "PGM=${PGM} v${VER}" >> ${TMP}

cat ${TMP}|mailx -s "status:${HOSTNAME}" ${MAILTO}
echo "`date` ${PGM} v${VER}: Mailed to ${MAILTO}"|tee -a ${LOG}

rm ${TMP}
exit 0

