[solved] [1.12] Problems with auto-archiving of reports


(Harald) #1

As I often get a maximum execution time timeout error when starting my Piwik (on shared hosting), I tried to “Set up a Crontab to Automatically Archive the Reports”.

The web page “How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo” says to create a crontab entry like this:


5 * * * * www-data /usr/bin/php5 /path/to/piwik/misc/cron/archive.php -- url=http://example.org/piwik/ > /home/example/piwik-archive.log

I suspect a typo there and that it should read:


5 * * * * www-data /usr/bin/php5 /path/to/piwik/misc/cron/archive.php --url=http://example.org/piwik/ > /home/example/piwik-archive.log

So my entry looks like this:


5 * * * *  /vrmd/homepages/<myuserid>/piwik/misc/cron/archive.php --url=http://piwik.mydomain.tld/ > /vrmd/homepages/<myuserid>/itc/piwik-archive.log

, where “/vrmd/homepages//” is the absolute server path to my pages.

The cronjob does run every hour at 5 past and I do get a report by email but:
[ol]
[li] an empty (0 bytes) “piwik-archive.log” is created in “/vrmd/homepages//itc/” and is shown in the shell as “piwik-archive.log?” and can only be deleted via “rm piwik-archive.*”; FTP client says: “No such file or directory”.
[/li][li] the mailed report reads:
[/li]/vrmd/homepages//piwik/misc/cron/archive.php: line 1: ?php: No such file or directory
/vrmd/homepages//piwik/misc/cron/archive.php: line 2: =: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 36: /bin: is a directory
/vrmd/homepages//piwik/misc/cron/archive.php: line 37: Ideas: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 38: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 39: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 40: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 41: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 42: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 43: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 44: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 45: syntax error near unexpected token (' /vrmd/homepages/<myuserid>/piwik/misc/cron/archive.php: line 45: - Possible performance improvement: Run first websites which are faster to process (weighted by visits and/or time to generate the last daily report)’
[/ol]

What is wrong?


(Matthieu Aubry) #2

there was no typo in the doc, so if you add the space it should work


(Harald) #3

[quote=matt]
there was no typo in the doc, so if you add the space it should work[/quote]
Before I apparently did not properly install the modified crontab.
After correcting this I added the space to look like this:


5 * * * *  links /vrmd/homepages/<myuserid>/piwik/misc/cron/archive.php --- url=http://piwik.mydomain.tld/ > /vrmd/homepages/<myuserid>/itc/piwik-archive.log

Result: “ELinks: Unknown option --”

Besides not giving the expected result it leaves one question:
If there is no typo in the doc and the space belongs there, why is there no space neither in the screenshot in the mentioned doc nor in the USAGE section of the archive.php itself in the numerous examples of that argument given there and again in the message I get when trying to run the archive.php through the browser ?
Just for curiosity I took the space out again and got: “ELinks: Unknown option --url=http://piwik.mydomain.tld/”.

If I run archive.php from the shell, I get
./misc/cron/archive.php: line 1: ?php: No such file or directory
./misc/cron/archive.php: line 2: =: command not found
./misc/cron/archive.php: line 36: /bin: is a directory
./misc/cron/archive.php: line 37: Ideas: command not found
./misc/cron/archive.php: line 38: -: command not found
./misc/cron/archive.php: line 39: -: command not found
./misc/cron/archive.php: line 40: -: command not found
./misc/cron/archive.php: line 41: -: command not found
./misc/cron/archive.php: line 42: -: command not found
./misc/cron/archive.php: line 43: -: command not found
./misc/cron/archive.php: line 44: -: command not found
./misc/cron/archive.php: line 45: syntax error near unexpected token (' ./misc/cron/archive.php: line 45: - Possible performance improvement: Run first websites which are faster to process (weighted by visits and/or time to generate the last daily report)’

with or without the space in “-- url=…”

So no success with either version. Put the space in again and got “ELinks: Unknown option --” again.
What else can I do?


(Matthieu Aubry) #4

it should have only two dashes


-- url


(Harald) #5

Sorry matt, a copy&paste error here.
In the crontab there are only two dashes (as shown by the error messages “ELinks: …”).


(Harald) #6

I’m sorry again, but I got confused between the Piwik doc and my web hoster’s crontab examples.
Now a ‘clean’ start, still kindly asking for help.

The crontab:


$ crontab -l
MAILTO="siteadmin@mydomain.tld"
5 * * * *  /vrmd/homepages/<myuserid>/piwik/misc/cron/archive.php -- url=http://piwik.mydomain.tld/ > /vrmd/homepages/<myuserid>/itc/piwik-archive.log

Result in the mailed report:
/vrmd/homepages//piwik/misc/cron/archive.php: line 1: ?php: No such file or directory
/vrmd/homepages//piwik/misc/cron/archive.php: line 2: =: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 35: /bin: is a directory
/vrmd/homepages//piwik/misc/cron/archive.php: line 36: Ideas: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 37 -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 38: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 39: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 40: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 41: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 42: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 43: -: command not found
/vrmd/homepages//piwik/misc/cron/archive.php: line 44: syntax error near unexpected token (' /vrmd/homepages/<myuserid>/piwik/misc/cron/archive.php: line 44: - Possible performance improvement: Run first websites which are faster to process (weighted by visits and/or time to generate the last daily report)’

What is wrong?


(Matthieu Aubry) #7

pleas ask your hosted to setup according to instructions: How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo

eg. your cronis lacking the /bin/php5 call


(Harald) #8

Thank you, matt, you were right.
Instructions by the hoster had been somewhat misleading.