--- Makefile +++ Makefile @@ -60,7 +60,7 @@ endif BINDIR = $(BASEDIR)/sbin -MANDIR = $(BASEDIR)/man +MANDIR = $(BASEDIR)/share/man #-------------------------------------------------------------------------- --- examples/logrotate.cron +++ examples/logrotate.cron @@ -1,8 +1,17 @@ #!/bin/sh -/usr/sbin/logrotate /etc/logrotate.conf -EXITVALUE=$? +TMPF=`mktemp /tmp/logrotate.XXXXXXXXXX` + +/usr/sbin/logrotate /etc/logrotate.conf 2>&1 | tee $TMPF +EXITVALUE=${PIPESTATUS[0]} + if [ $EXITVALUE != 0 ]; then - /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" + # wait a sec, we might just have restarted syslog + sleep 1 + # tell what went wrong + /bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" + /bin/logger -t logrotate -f $TMPF fi + +rm -f $TMPF exit 0