#!/bin/sh

MAILTO=""
ARG=""

if [ -e /etc/sysconfig/logrotate ]; then
	. /etc/sysconfig/logrotate
fi

/usr/sbin/logrotate $ARG /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
	/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
	if [ -n "$MAILTO" ]; then
		echo "ALERT exited abnormally with [$EXITVALUE]" |  mail -s "logrotate exited abnormally" $MAILTO
	fi
fi
exit 0
