From cf0fa60b4d7279d6dc3deae071a0ff9555823e40 Mon Sep 17 00:00:00 2001 From: Ken Neighbors Date: Wed, 28 Apr 2010 09:54:58 -0700 Subject: Show error messages from cron jobs (update.sh and buildstatic.sh). --- debian/buildstatic.sh | 12 +++++++++--- debian/update.sh | 9 +++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/debian/buildstatic.sh b/debian/buildstatic.sh index 91dd4d9..9f41cbc 100755 --- a/debian/buildstatic.sh +++ b/debian/buildstatic.sh @@ -16,6 +16,7 @@ BUILDSTATICPAGES=/usr/share/awstats/tools/awstats_buildstaticpages.pl cd /etc/awstats +TMPFILE=`mktemp /tmp/awstats.XXXXXXXXXX` for c in awstats \ `/bin/ls -1 awstats.*.conf 2>/dev/null | \ /bin/sed 's/^awstats\.\(.*\)\.conf/\1/'` @@ -24,11 +25,16 @@ do m=`date +%m` mkdir -p /var/cache/awstats/$c/$Y/$m/ AL=${AWSTATS_LANG:-en} - $BUILDSTATICPAGES \ + if ! $BUILDSTATICPAGES \ -config=$c \ -year=$Y \ -month=$m \ -lang=$AL \ -staticlinksext=${AL}.html \ - -dir=/var/cache/awstats/$c/$Y/$m/ -done >/dev/null + -dir=/var/cache/awstats/$c/$Y/$m/ >$TMPFILE 2>&1 + then + # an error occurred + cat $TMPFILE >&2 + fi +done +rm -f $TMPFILE diff --git a/debian/update.sh b/debian/update.sh index bd49d5d..11a8e03 100755 --- a/debian/update.sh +++ b/debian/update.sh @@ -14,9 +14,14 @@ AWSTATS=/usr/lib/cgi-bin/awstats.pl cd /etc/awstats +TMPFILE=`mktemp /tmp/awstats.XXXXXXXXXX` for c in awstats \ `/bin/ls -1 awstats.*.conf 2>/dev/null | \ /bin/sed 's/^awstats\.\(.*\)\.conf/\1/'` do - $AWSTATS -config=$c -update -done >/dev/null + if ! $AWSTATS -config=$c -update >$TMPFILE 2>&1; then + # an error occurred + cat $TMPFILE >&2 + fi +done +rm -f $TMPFILE -- 1.5.6.5