#! /bin/sh #--------------------------------------------------------------------------- # /etc/cron.daily/logrotate # # Creation : 2011-02-10 holbru # Last update: $Id$ # # Copyright (c) 2001-2011 the eisfair team, team(at)eisfair(dot)org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #--------------------------------------------------------------------------- NAME=logrotate DAEMON=/usr/sbin/${NAME} LOG_NAME=logger LOG=/usr/bin/${LOG_NAME} SENDMAIL=/usr/sbin/sendmail QUALIFY_DOMAIN=`/bin/dnsdomainname` # check if DAEMON exists and has executable rights if [ ! -x "${DAEMON}" ] then ${LOG} -t logrotate "logrotate is missing, or has no executable rights - exiting" exit 1 fi # exit immediately if there is another instance running if checkproc ${DAEMON} then ${LOG} -t logrotate "ALERT another instance of logrotate is running - exiting" exit 1 fi TMPF=`mktemp -t logrotate.XXXXXXXXXX` ${DAEMON} /etc/logrotate.conf 2>&1 >> ${TMPF} if [ -s "${TMPF}" ] then # wait a sec, we might just have restarted syslog sleep 1 { echo "From: The Logrotate Agent " echo "To: " echo "Subject: Logrotate Report from Server '${HOSTNAME}'" echo echo echo "Dispatched from Logrotate on Server '${HOSTNAME}'" echo "Current Date: `/bin/date +%Y-%m-%d` Time: `/bin/date +%H:%M:%S`" echo cat ${TMPF} } | ${SENDMAIL} administrator@${HOSTNAME} fi rm -f ${TMPF} exit 0 #--------------------------------------------------------------------------- # end #---------------------------------------------------------------------------