Package: webalizer
Severity: minor
Tags: patch

As AWK is standard in Debian core, the code in /etc/cron.daily/webalizer
can be greatly simplified with it. It becomes also easier to maintain
and uses fewer processes.

SUGGESTION 1

nonrotatedlog=`egrep '^LogFile' $WEBALIZER_CONF | \
               sed -e 's/[[:space:]]\+/ /' | \
               cut -d ' ' -f2 | \
               sed -e  's/\.[[:digit:]][\.gz]*$//'`

=> Use instead (ps. above, the '[\.gz]*' is not what is wanted):

awk '$1 ~ /^LogFile$/ {gsub(/\.[0-9]+(\.gz)?/,""); print $2}' $WEBALIZER_CONF

SUGGESTION 2

logsz=`echo ${nonrotatedlog} | \
       sed -e 's/[[:space:]]\+/ /' | \
       cut -d ' ' -f2 | \
       xargs ls -l | \
       sed -e 's/[[:space:]]\+/ /g' | \
       cut -d ' ' -f5`
[ $logsz -gt 0 ] || exit 0



=> Use instead; normal shell empty file check, see test(1):

       -s FILE
              FILE exists and has a size greater than zero

[ -s $nonrotatedlog ] || exit 1



-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.11-1-686
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to en_US)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to