Package: awstats Version: 6.9.5~dfsg-2 Severity: wishlist Tags: patch
Again with inspiration from /etc/default/rsync and /etc/init.d/rsync, I set up an option in /etc/default/awstat called AWSTATS_NICE. It sets the niceness level for awstats.pl and awstats_buildstaticpages.pl run from update.sh and buildstatic.sh. Default value is 10. Note that unlike /etc/init.d/rsync, I did not include error checking for this value. Here is some code from /etc/init.d/rsync you might consider (or just let me know if you'd like me to create a patch that includes this type of error-checking on AWSTATS_NICE): case "x$RSYNC_NICE" in x[0-9]) RSYNC_NICE_PARM="--nicelevel $RSYNC_NICE";; x[1-9][0-9]) RSYNC_NICE_PARM="--nicelevel $RSYNC_NICE";; x) ;; *) log_warning_msg "Value of RSYNC_NICE in $RSYNC_DEFAULTS_FILE must be a value between 0 and 19 (inclusive);" log_warning_msg "ignoring RSYNC_NICE now." ;; esac Note: the included patch was generated in comparison to the resulting files from my previous patches (580672 and 580692). http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580672 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580692 -- 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
# AWStats configuration options # This variable controls the scheduling priority for updating AWStats # datafiles and for generating static html reports. Normal priority # is 0 and a lower priority is 10. See "man nice" for more info. AWSTATS_NICE=10 # 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 ## ## update.sh, written by Sergey B Kirpchev <skirpic...@gmail.com> ## ## Update AWStats data for all configs, awstats.*.conf (Debian specific) ## set -e DEFAULT=/etc/default/awstats AWSTATS=/usr/lib/cgi-bin/awstats.pl [ -f $AWSTATS ] || exit 1 [ -r "$DEFAULT" ] && . "$DEFAULT" NICE=${AWSTATS_NICE:-10} 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 if ! nice -n $NICE $AWSTATS -config=$c -update >$TMPFILE 2>&1; then # an error occurred cat $TMPFILE >&2 fi done rm -f $TMPFILE
#!/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" NICE=${AWSTATS_NICE:-10} 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 ! nice -n $NICE $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