Koozali.org: home of the SME Server

Obsolete Releases => SME 7.x Contribs => Topic started by: shodanki on September 07, 2008, 11:22:59 AM

Title: Awstats problem (Qmail Statistics)
Post by: shodanki on September 07, 2008, 11:22:59 AM
I have installed awstats acourding to the how to for die Qmail statistics and basicly it works fine.
but since then i hav every hour an error report from cron that states this :

subject:  /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=mail >/dev/null

/bin/ls: /var/log/qmail/*.s: No such file or directory
/bin/basename: too few arguments
Try `/bin/basename --help' for more information.


How do i fix it ?
regards
shodan
Title: Re: Awstats problem (Qmail Statistics)
Post by: davelister on September 07, 2008, 01:21:48 PM
I had the same problem

I noticed the /etc/e-smith/templates-custom/etc/crontab/awstats file pointed to a different location to where my awstats is located. So all I did was change it to point to /var/www/awstats/awstats.pl

then I rebuilt the template by /sbin/e-smith/expand-templates /etc/crontab

Hope that might be of some help to you. If not I hope someone here could please correct me (in a nice fashion would be great :-)
Title: Re: Awstats problem (Qmail Statistics)
Post by: m on September 07, 2008, 01:33:25 PM
The pre-processor script has a bug. It can not deal with missing rotated log files. I'll fix it.
Title: Re: Awstats problem (Qmail Statistics)
Post by: m on September 07, 2008, 01:48:35 PM
A fixed qmail-awstats-setup.v2.sh script is immediately available here (http://neddix.com/sme7/Qmail-AWStats/qmail-awstats-setup.v2.sh) and from the updated Wiki page as soon as the mirrors have synced.
Title: Re: Awstats problem (Qmail Statistics)
Post by: m on September 07, 2008, 01:55:41 PM
I had the same problem
I don't think so. Are you sure that you have installed awstats-6.7-1 from Sourceforge and not installed or updated the RPM from the dag repository? The EL4 RPM from dag is incomplete, a needed script is missing. Cannot remember what it was a the moment.
Title: Re: Awstats problem (Qmail Statistics)
Post by: shodanki on September 07, 2008, 02:20:01 PM
Jep , fixed the problem.
thanks for the quick solution.
regards
Shoddan
Title: Re: Awstats problem (Qmail Statistics)
Post by: dz00te on September 15, 2008, 09:42:47 AM
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
Title: Re: Awstats problem (Qmail Statistics)
Post by: pmstewart on October 01, 2008, 04:55:56 PM
It appears the problem stems from awstats being installed from the wiki:

http://wiki.contribs.org/AWStats

Then the how-to is being followed from here:

http://wiki.contribs.org/Qmail_Statistics_(AWStats)

**NOTE** This could break your installed awstats!   The template 86awstats redirects the installed awstats away from the /var/www install

directory. To fix your installed awstats copy or move the 86awstats from the templates-custom and signal-event post-upgrade signal-event reboot.


The install script v2 ports Qmail_Statistics_(AWStats) to the /usr/local/awstats/wwwroot where a "standard" linux package would be placed.

For it to work correctly with the SME contrib and display this in the panel manager the fixes seen are not suitable to display the information from within
server-manager.

Since I'm no coding guru maybe we could encourage the maintainer to rewrite the script to be compatible with the awstats contrib.

Paul
Title: Re: Awstats problem (Qmail Statistics)
Post by: Brenno on December 05, 2008, 07:57:44 PM
I, too, am getting this message every hour.  The body of the email says:

/usr/bin/test: /var/log/qmail/@40000000493422961eecb9a4.s: binary operator expected

I followed the howto from http://wiki.contribs.org/Qmail_Statistics_(AWStats) to install and configure and my qmail-awstats-setup.v2.sh file is dated as Sep 07, so I'm assuming it's the correct one.

So... which is the correct fix - the one posted by dz00te or the one posted by davelister?
Title: Re: Awstats problem (Qmail Statistics)
Post by: mazkot on March 19, 2009, 06:39:48 AM
Just installed it.. and I receive this message every 3 hours.

Subject:     Cron <root@sme> /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=mail >/dev/null
/usr/bin/test: too many arguments

any updates on the fix
Title: Re: Awstats problem (Qmail Statistics)
Post by: Jean-Philippe Pialasse on May 08, 2010, 08:47:57 PM
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  :
Code: [Select]
# /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 :
Code: [Select]
/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.
Title: Re: Awstats problem (Qmail Statistics)
Post by: shawnbishop on September 01, 2010, 10:41:19 AM
Good Day

I have installed as per the Wiki, and I get the following.. I have read the posts above, so which is the correct fix?

/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=mail >/dev/null
/usr/bin/test: too many arguments
Title: Re: Awstats problem (Qmail Statistics)
Post by: Jean-Philippe Pialasse on September 01, 2010, 02:00:45 PM
works fine with the one i gave

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 ! `/bin/ls -l  /var/log/qmail/*.s|grep -v ^l | wc -l` -ge 1 && /bin/touch /var/log/qmail/awstats_dummy.s
Title: Re: Awstats problem (Qmail Statistics)
Post by: shawnbishop on September 01, 2010, 04:35:14 PM
Excellent, thanks..it worked