Hi,
Same problem here. Every hour i receive an email:
Cron <root@yoda> /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=mail >/dev/null
/usr/bin/test: too many arguments
I've fixed changing the first line of /home/e-smith/awstats/qmail-preprocessor.sh
from:
/usr/bin/test ! -f /var/log/qmail/*.s && /bin/touch /var/log/qmail/awstats_dummy.s
to:
/usr/bin/test ! -f "/var/log/qmail/*.s" && /bin/touch /var/log/qmail/awstats_dummy.s
tnx for the contrib
z
This is not a correct fix.
This line is intended to create a file /var/log/qmail/awstats_dummy.s only if there is no file with the pattern /var/log/qmail/*.s.
with your suggestion the dummy file will be created each time, resulting in data loss after a log rotate.
if you want to verify :
# /usr/bin/test ! -f "/var/log/qmail/*.s" && echo 'no files'
no files
# /usr/bin/test ! -f "/var/log/qmail/*.ds" && echo 'no files'
no files
# /usr/bin/test ! -f /var/log/qmail/*.s && echo 'no files'
/usr/bin/test: trop d'arguments
# /usr/bin/test ! -f /var/log/qmail/*.ds && echo 'no files'
no files
the correct patch would be :
/usr/bin/test ! `/bin/ls -l /var/log/qmail/*.s|grep -v ^l | wc -l` -ge 1 && /bin/touch /var/log/qmail/awstats_dummy.s
that way the script search for the existence of a number of regular files with the pattern *.s and if it is less than 0 create the dummy. If it is more than 0 do nothing AND returns no errors.