1

Topic: [SOLVED] Awstats in Ubuntu 11.04

==== Provide basic information to help troubleshoot ====
- iRedMail version: 0.7.2
- Linux/BSD distribution name and version: Ubuntu 11.04
====

I noticed that awstats cronjobs weren't been executed successfully thus awstats not working correctly(Empty results).

Aug  9 03:10:01 ec2 CRON[9810]: (CRON) error (grandchild #9811 failed with exit status 1)

I have several messages like that.

I identified that in the installation "function/awstats.sh" script changed the awstats.pl file location(Line 35):

...
 31     # Move awstats.pl to ${AWSTATS_CGI_DIR} on Debian/Ubuntu, so that it won't
 32     # conflict with other cgi programs, e.g. mailman.
 33     if [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" -o X"${DISTRO}" == X"SUSE" ]; then
 34         mkdir -p ${AWSTATS_CGI_DIR}/awstats/ 2>/dev/null
 35         mv ${AWSTATS_CGI_DIR}/awstats.pl ${AWSTATS_CGI_DIR}/awstats/ 2>/dev/null
 36         export AWSTATS_CGI_DIR="${AWSTATS_CGI_DIR}/awstats"
 37     fi
...

But it didn't change other scripts as well.

I need to change those scripts:

File: /usr/share/awstats/tools/awstats_buildstaticpages.pl

root@ec2:[/usr/share/awstats/tools]:diff awstats_buildstaticpages.pl.orig awstats_buildstaticpages.pl
311,312c311,312
< elsif (-s "/usr/lib/cgi-bin/awstats.pl") {
<     $Awstats="/usr/lib/cgi-bin/awstats.pl";
---
> elsif (-s "/usr/lib/cgi-bin/awstats/awstats.pl") {
>     $Awstats="/usr/lib/cgi-bin/awstats/awstats.pl";

File: /usr/share/awstats/tools/buildstatic.sh

root@ec2:[/usr/share/awstats/tools]:diff buildstatic.sh.orig buildstatic.sh
11c11
< AWSTATS=/usr/lib/cgi-bin/awstats.pl
---
> AWSTATS=/usr/lib/cgi-bin/awstats/awstats.pl

File: /usr/share/awstats/tools/update.sh

root@ec2:[/usr/share/awstats/tools]:diff update.sh.orig update.sh
11c11
< AWSTATS=/usr/lib/cgi-bin/awstats.pl
---
> AWSTATS=/usr/lib/cgi-bin/awstats/awstats.pl

Basically I added the awstats to the paths...

Thanks!

2

Re: [SOLVED] Awstats in Ubuntu 11.04

terciof wrote:

Basically I added the awstats to the paths...

Do you mean you have "/usr/lib/cgi-bin/awstats.pl" exist?
Can you access https://your_server/cgi-bin/awstats.pl without authentication?==== Provide basic information to help troubleshoot ====
- iRedMail version:
- Linux/BSD distribution name and version:
- Any related log? Log is helpful for troubleshooting.
====

3

Re: [SOLVED] Awstats in Ubuntu 11.04

ZhangHuangbin wrote:
terciof wrote:

Basically I added the awstats to the paths...

Do you mean you have "/usr/lib/cgi-bin/awstats.pl" exist?
Can you access https://your_server/cgi-bin/awstats.pl without authentication?==== Provide basic information to help troubleshoot ====
- iRedMail version:
- Linux/BSD distribution name and version:
- Any related log? Log is helpful for troubleshooting.
====

No I don't have it.

The awstats.pl has been moved to a awstats folder inside cgi-bin directory.

I disabled cgi-bin in the apache confs, I use the URL: https://myserver/awstats/awstats.pl

It requires authentication, as usually no problem with that...

The issue here is that the Installation scripts doesn't change the awstats support scripts to the new awstats.pl location( inside awstats folder)

Regards!

4

Re: [SOLVED] Awstats in Ubuntu 11.04

FYI:

root@ec2:[/usr/lib/cgi-bin]:find .
.
./awstats
./awstats/awstats.pl

5

Re: [SOLVED] Awstats in Ubuntu 11.04

Fixed this issue, it won't create new directory anymore:
http://code.google.com/p/iredmail/sourc … 370512b02d

Thanks for your feedback.

P.S. Why we create new directory for Awstats? If we use /cgi-bin/ directly with authentication required, other CGI programs (e.g. Mailman, mailgraph) will require same authentication too.

6

Re: [SOLVED] Awstats in Ubuntu 11.04

ZhangHuangbin wrote:

Fixed this issue, it won't create new directory anymore:
http://code.google.com/p/iredmail/sourc … 370512b02d

Thanks for your feedback.

P.S. Why we create new directory for Awstats? If we use /cgi-bin/ directly with authentication required, other CGI programs (e.g. Mailman, mailgraph) will require same authentication too.


Cool! I'll re-install another machine to create a internal crash/recovery procedure and will include this fix.

Thanks again for the prompt reply.

7

Re: [SOLVED] Awstats in Ubuntu 11.04

==== Provide basic information to help troubleshoot ====
- iRedMail version: 0.7.3
- Linux/BSD distribution name and version: Ubuntu 11.04 Natty
====

I had another issue with ubuntu 11.04.

After a clean install in the Amazon EC2 I have several emails from www-data like that:

Create/Update database for config "/etc/awstats/awstats.smtp.conf" by AWStats version 6.95 (build 1.943)
From data in log file "perl /usr/share/doc/awstats/examples/maillogconvert.pl standard < /var/log/mail.log |"...
sh: cannot open /var/log/mail.log: Permission denied
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Error: Command for pipe 'perl /usr/share/doc/awstats/examples/maillogconvert.pl standard < /var/log/mail.log |' failed
Setup ('/etc/awstats/awstats.smtp.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Create/Update database for config "/etc/awstats/awstats.web.conf" by AWStats version 6.95 (build 1.943)
From data in log file "/var/log/apache2/access.log"...
Error: Couldn't open server log file "/var/log/apache2/access.log" : Permission denied
Setup ('/etc/awstats/awstats.web.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Create/Update database for config "/etc/awstats/awstats.conf" by AWStats version 6.95 (build 1.943)
From data in log file "/var/log/apache2/access.log"...
Error: Couldn't open server log file "/var/log/apache2/access.log" : Permission denied
Setup ('/etc/awstats/awstats.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

I figured out that the awstats installation creates a cron.d job in /etc/cron.d/awstats that is:

*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh

# Generate static reports:
10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh

As the iRedMail already configure cron to generate awstats reports, I just commented out those lines in /etc/cron.d/awstats.

I'm not sure if this is a 11.04 issue only.

Regards.

8

Re: [SOLVED] Awstats in Ubuntu 11.04

iRedMail doesn't create file "/etc/cron.d/awstats", it must be created automatically by Awstats package.