Question
I want to set up TWiki to automatically run the statistics command as a cron job.
I created a cron job in Webmin to run /var/www/twiki/bin/statistics.
When I run this command, either as apache (the usual TWiki-accessing user) or as root, I get this error:
Can't locate TWiki.pm in @INC (@INC contains: ../lib . /usr/lib/perl5/5.6.1/i386-linux
/usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i386-linux
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.6.1/i386-linux
/usr/lib/perl5/vendor_perl/5.6.1
/usr/lib/perl5/vendor_perl) at /var/www/twiki/bin/statistics line 29.
BEGIN failed--compilation aborted at /var/www/twiki/bin/statistics line 29.
I guess that means it can't find TWiki.pm, despite that it is actually in ../lib relative to the folder the command is located in.
So I changed the command to run cd /var/www/twiki/bin/;./statistics.
This produced the following output:
TWiki: Create Usage Statistics
* Executed by a guest or a cron job scheduler
* Statistics for Dec 2002
* Checking TWiki.Know web
- view: 1, save: 0, upload: 0
- top view: 1 [[WebHome]]
ci: %FILENAME%: No such file or directory
- Topic WebStatistics updated
* Checking TWiki.Main web
- view: 1, save: 0, upload: 0
- top view: 1 [[WebHome]]
ci: %FILENAME%: No such file or directory
- Topic WebStatistics updated
* Checking TWiki.TWiki web
- view: 2, save: 0, upload: 0
- top view: 1 [[WebHome]]
ci: %FILENAME%: No such file or directory
- Topic WebStatistics updated
* Checking TWiki.Trash web
- view: 0, save: 0, upload: 0
ci: %FILENAME%: No such file or directory
- Topic WebStatistics updated
* Checking TWiki.Boone web
- view: 115, save: 10, upload: 0
- top view: 16 [[WebHome]]
- top contributor: 10 Main.MikeBoone
ci: %FILENAME%: No such file or directory
- Topic WebStatistics updated
* Checking TWiki.Archive web
- view: 0, save: 0, upload: 0
ci: %FILENAME%: No such file or directory
- Topic WebStatistics updated
End creating usage statistics
And this seemed to work. My only concern is those "No such file or directory" errors.
Did I set up the cron job properly, and if not, what is the correct way?
- TWiki version: Dec 2001
- Perl version: 5.6.1
- Web server & version: Apache 1.3.23
- Server OS: Redhat 7.3
- Web browser & version:
- Client OS:
--
MikeBoone - 11 Dec 2002
Answer
You do need to include the
cd command in the cron job, as mentioned in the manual
As for the '%FILENAME%' thing, I'm not sure what causes this, but it's always a good test to see if you get this when running statistics from the bin directory in the shell.
--
RichardDonkin - 11 Dec 2002
I was looking at the install instructions and didn't see it. The manual entry is in
TWikiSiteTools#WebStatistics_Site_Usage_Log.
I ran the command in the shell and still got the '%FILENAME%' errors. But the stats seem OK, so I'm not too concerned as it's a home system.
--
MikeBoone - 12 Dec 2002