Package: awstats Version: 6.9.5~dfsg-2 Severity: wishlist Tags: patch
The script buildstatic.sh is run by cron every night to create static html reports in /var/cache/awstats. I would prefer not to have static reports generated, so I created an option in /etc/default/awstat to turn off this feature. With inspiration from /etc/default/rsync and /etc/init.d/rsync, I set up an option in /etc/default/awstat called AWSTATS_ENABLE_BUILDSTATICPAGES. If set to "yes" then buildstatic.sh will run every night to build static pages. If set to "no" (which I think should be the default, but feel free to make up your own mind), then buildstatic.sh will not build static pages. I placed a short note in README.Debian about it. -- System Information: Debian Release: 5.0.4 APT prefers stable APT policy: (500, 'stable'), (50, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages awstats depends on: ii perl 5.10.0-19lenny2 Larry Wall's Practical Extraction Versions of packages awstats recommends: ii libnet-xwhois-perl 0.90-3 Whois Client Interface for Perl5 Versions of packages awstats suggests: pn apache2 | httpd <none> (no description available) pn libgeo-ipfree-perl <none> (no description available) pn libnet-dns-perl <none> (no description available) pn libnet-ip-perl <none> (no description available) ii liburi-perl 1.35.dfsg.1-1 Manipulates and accesses URI strin -- no debconf information
>From 3492ee4e32a1dd2cafa982c6603b7f8afe14564d Mon Sep 17 00:00:00 2001 From: Ken Neighbors <k...@nsds.com> Date: Wed, 28 Apr 2010 22:31:40 -0700 Subject: Add option to disable nightly generation of static html reports. --- debian/README.Debian | 1 + debian/buildstatic.sh | 5 +++++ debian/default/awstats | 4 ++++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index d5a9a1e..ed8b69f 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -8,6 +8,7 @@ Do the following for a simple setup of a single website with Apache 2.x: * Edit /etc/logrotate.d/apache2 to permit www-data access to logfiles * copy /usr/share/doc/awstats/examples/apache.conf to /etc/apache2/conf.d/ + * edit /etc/default/awstats to enable nightly build of static html reports The above is _NOT_ supported or recommended! Please read the rest of this document instead... diff --git a/debian/buildstatic.sh b/debian/buildstatic.sh index 9f41cbc..ca09cc7 100755 --- a/debian/buildstatic.sh +++ b/debian/buildstatic.sh @@ -14,6 +14,11 @@ BUILDSTATICPAGES=/usr/share/awstats/tools/awstats_buildstaticpages.pl [ -f $AWSTATS -a -f $BUILDSTATICPAGES ] || exit 1 [ -r "$DEFAULT" ] && . "$DEFAULT" +ENABLE=${AWSTATS_ENABLE_BUILDSTATICPAGES:-no} +if [ "$ENABLE" != "yes" ]; then + exit 0 +fi + cd /etc/awstats TMPFILE=`mktemp /tmp/awstats.XXXXXXXXXX` diff --git a/debian/default/awstats b/debian/default/awstats index 3785ea3..d8830cc 100644 --- a/debian/default/awstats +++ b/debian/default/awstats @@ -1,5 +1,9 @@ # AWStats configuration options +# This variable controls whether to create static html reports every +# night in /var/cache/awstats/. Set to "yes" or "no". +AWSTATS_ENABLE_BUILDSTATICPAGES="no" + # This variable control the language of all static html reports. Set # one to appropriate two-letter language code (default to en). #AWSTATS_LANG=ru -- 1.5.6.5
# AWStats configuration options # This variable controls whether to create static html reports every # night in /var/cache/awstats/. Set to "yes" or "no". AWSTATS_ENABLE_BUILDSTATICPAGES="no" # This variable control the language of all static html reports. Set # one to appropriate two-letter language code (default to en). #AWSTATS_LANG=ru
#!/bin/sh ## ## buildstatic.sh, written by Sergey B Kirpichev <skirpic...@gmail.com> ## ## Build all static html reports from AWStats data (Debian specific) ## set -e DEFAULT=/etc/default/awstats AWSTATS=/usr/lib/cgi-bin/awstats.pl BUILDSTATICPAGES=/usr/share/awstats/tools/awstats_buildstaticpages.pl [ -f $AWSTATS -a -f $BUILDSTATICPAGES ] || exit 1 [ -r "$DEFAULT" ] && . "$DEFAULT" ENABLE=${AWSTATS_ENABLE_BUILDSTATICPAGES:-no} if [ "$ENABLE" != "yes" ]; then exit 0 fi 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 Y=`date +%Y` m=`date +%m` mkdir -p /var/cache/awstats/$c/$Y/$m/ AL=${AWSTATS_LANG:-en} if ! $BUILDSTATICPAGES \ -config=$c \ -year=$Y \ -month=$m \ -lang=$AL \ -staticlinksext=${AL}.html \ -dir=/var/cache/awstats/$c/$Y/$m/ >$TMPFILE 2>&1 then # an error occurred cat $TMPFILE >&2 fi done rm -f $TMPFILE