Koozali.org: home of the SME Server

Awstats problem (Qmail Statistics)

Offline shodanki

  • 13
  • +0/-0
Awstats problem (Qmail Statistics)
« 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

Offline davelister

  • *
  • 51
  • +0/-0
    • IgnitionJournal
Re: Awstats problem (Qmail Statistics)
« Reply #1 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 :-)

Offline m

  • ****
  • 276
  • +0/-0
  • Peet
Re: Awstats problem (Qmail Statistics)
« Reply #2 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.

Offline m

  • ****
  • 276
  • +0/-0
  • Peet
Re: Awstats problem (Qmail Statistics)
« Reply #3 on: September 07, 2008, 01:48:35 PM »
A fixed qmail-awstats-setup.v2.sh script is immediately available here and from the updated Wiki page as soon as the mirrors have synced.

Offline m

  • ****
  • 276
  • +0/-0
  • Peet
Re: Awstats problem (Qmail Statistics)
« Reply #4 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.

Offline shodanki

  • 13
  • +0/-0
Re: Awstats problem (Qmail Statistics)
« Reply #5 on: September 07, 2008, 02:20:01 PM »
Jep , fixed the problem.
thanks for the quick solution.
regards
Shoddan

Offline dz00te

  • 6
  • +0/-0
Re: Awstats problem (Qmail Statistics)
« Reply #6 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

Offline pmstewart

  • *
  • 73
  • +0/-0
Re: Awstats problem (Qmail Statistics)
« Reply #7 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
« Last Edit: October 01, 2008, 05:41:35 PM by pmstewart »

Offline Brenno

  • ****
  • 208
  • +0/-0
Re: Awstats problem (Qmail Statistics)
« Reply #8 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?

Offline mazkot

  • **
  • 59
  • +0/-0
Re: Awstats problem (Qmail Statistics)
« Reply #9 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

Offline Jean-Philippe Pialasse

  • *
  • 2,765
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Awstats problem (Qmail Statistics)
« Reply #10 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.
« Last Edit: May 08, 2010, 08:54:09 PM by unnilennium »

Offline shawnbishop

  • ****
  • 298
  • +0/-0
Re: Awstats problem (Qmail Statistics)
« Reply #11 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

Offline Jean-Philippe Pialasse

  • *
  • 2,765
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Awstats problem (Qmail Statistics)
« Reply #12 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
« Last Edit: September 01, 2010, 02:02:44 PM by unnilennium »

Offline shawnbishop

  • ****
  • 298
  • +0/-0
Re: Awstats problem (Qmail Statistics)
« Reply #13 on: September 01, 2010, 04:35:14 PM »
Excellent, thanks..it worked