Cpanel Cron job

Hi there,
I have set up quite a few cron jobs through cpanel successfuly in the past however the one for piwik has me stumped.

Just for clarification lets say my site name is “websitea.com” the path to pHP on my server is “/usr/bin/php”, Piwik is installed at http://www.websitea.com/PikStats/ and my cpanel username is “websitea”

Therefore if I am correct the cron should look like this:

/usr/local/bin/php -f /home/websitea/public_html/PikStats/misc/cron/archive.php – url=http://websitea.com/PikStats/ > /home/websitea/piwik-archive-output.log

Is this correct because it doesn’t appear to be working?

Thanks in advance for any help.

it looks good to me. Do you get any error in logs? any email sent to the email in case of cron error?

[quote=matt]
it looks good to me. Do you get any error in logs? any email sent to the email in case of cron error?[/quote]

No on both counts thats what is strange and I don’t see the file “piwik-archive-output.log” anywhere?

Thanks for helping Matt maybe you can also tell me if I can use a shared ssl with Piwik because I am seeing access in my stats to my pwik dashboard by others that shouldn’t have access and I know this is a big security risk, if it continues and I can’t use shared ssl I might have to uninstall Piwik and believe me I don’t want to do that.

If I can jump on this thread since my problem is similar… I just installed Piwik last week and I’m beginning to notice a measurable sluggish behavior of my vps server. Checked and the “server load” was throwing up a caution flag. I see that my database is reaching the 15K visitors range so I’ve been trying to run the cron to archive the data. Took a bit to figure the path correctly but finally figured it out. Now the cron will run, but I get an error on the cron email report…


Error in the last Piwik archive.php run: 
archive.php expects the argument --url to be set to your Piwik URL, for example: --url=http://example.org/piwik/ 
--help for more information

When trying to fix the cron path earlier, the tech support person from my hosting company changed a line in the /core/CronArchive.php file.
The line is…


return "Usage:
	/path/to/cli/php \"" . @$_SERVER['argv'][0] . "\" --url=http://my domain/Piwik/ [arguments]

“my domain” changed above for privacy.
Anyway, I believe this is what may be causing my error. I should have saved a copy of the original file before they tinkered with it, but like a fool, I didn’t.

Can someone tell me what the original code is for that line. I remember it being something generic.

EDIT: I found the original file and restored it but that didn’t solve my problem.


return "Usage:
/path/to/cli/php \"" . @$_SERVER['argv'][0] . "\" --url=http://your-website.org/path/to/piwik/ [arguments]

Still get the exact same error message.

Thanks.

Rick

Did you configure the cron as explained in How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo

[quote=matt]
Did you configure the cron as explained in How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo
Thank you for your response.

I been through that entire section about 2 dozen times it seems. As far as setting up the cron job, yes. Like I posted, it runs but returns the error…


Error in the last Piwik archive.php run: 
archive.php expects the argument --url to be set to your Piwik URL, for example: --url=http://example.org/piwik/ 
--help for more information

Is there a setting within the /core/CronArchive.php file that needs to be set? That is what the error sounds like it is looking for.

This is what I have my cron job…


/usr/bin/php /home/********/public_html/Piwik/misc/cron/archive.php --url=http://mywebsite.com/Piwik/ > /home/********/public_html/piwik-archive-output.log

server name removed =(********) as is the website name chamged to mywebsite.com
This is the way I interpret the guide as the way to do it.

Your cron command looks good, so sorry i’m not sure what is the problem. I could debug but may take some time to find the issue. Do you have access to another server to test again if you can reproduce?

No I do not have access to another server.
Updated to 2.1.0 this morning and still have exact same error message listed above.
Performed System Check through the dashboard and it said no problems found…


 Huzzah! There are no problems with your Piwik setup. Give yourself a pat on the back.

I’m at a lost right now.
I like the Piwik program, but if I can’t archive the data on a regular basis, it will just continue to build and degrade the server resources and speed.
Can’t have that. May have to just unistall it and look elsewhere.

please ask a sysadmin or someone who knows about cron, because it’s clear the cron is not working and that’s not a piwik bug

You can try online cron job http://www.easycron.com

Thanks for the link, that seems pretty cool. I havent really messed much with cronjobs though.


[my wordpress profile](http://profiles.wordpress.org/milandude)