Chdir(): Permission denied when running via cron

I have set up a cron job for running Piwik’s archive task - it looks like this (from /etc/crontab):

05 * * * * www /usr/local/www/piwik/misc/cron/ > /dev/null

It doesn’t work, and every time it runs, I get a mail with an error message like this one:

Warning: chdir(): Permission denied (errno 13) in /usr/local/www/piwik/core/Config.php on line 171

I don’t understand why Piwik is trying to chdir here, and if I run the command via sudo (sudo -u www /usr/local/www/piwik/misc/cron/, it runs without complaints.

Any idea what’s going on?

Try commenting out the chdir. I suspect it’s unnecessary if we’re already using absolute path names.

Maybe we should add a @ in front of it ? thoughts Anthon?

The chdir is legacy stuff – it predates the switch to absolute paths (vs relative to document root), and can probably be removed.

Commenting out the chmod-line seems to have silenced the errors, but I’m not quite sure that the cron-script actually works. How can I check?