Knowledge Base

23.02.11

awstats.pl called by "cronjob" from webfrontend fails

This almost drove me mad today. i was working on a webserver from Domainfactory and wanted to have a cronjob which should call

awstats.pl -config=www.domain.com -update

Unfortunately you cannot create cronjobs from shell but have to use their tool from the webfrontend to set up cronjobs. what happened is, that the cronjob never executed awstats.pl because awstats.pl reported all the time:

Did you use the correct URL ?

because it could not find the conf.file. however, the conf-file was there

The reason was, that this "cronjob" was actually some script from Domainfactory which was called by the webserver,and it set the Enviroment Variable "GATEWAY_INTERFACE" to 

GATEWAY_INTERFACE=CGI-Perl/1.1

But if awstats.pl finds this variable, it thinks it is called by a browser:

if ( $ENV{'GATEWAY_INTERFACE'} ) {
                print
"- ${tagbold}Did you use the correct URL ?${tagunbold}${tagbr}\n";
                print
"Example: localhost/awstats/awstats.pl;
                print
"Example: 127.0.0.1/cgi-bin/awstats.pl;
            }

The solution is to let this "cronjob" call some other script which before it calls awstats.pl empties the env value:

export GATEWAY_INTERFACE=

suddenly it started working.

drove me mad for 2 hours!

 



<- Zurück zur Übersicht