Chdir(): Permission denied when running via cron


#1

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/archive.sh > /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/archive.sh), it runs without complaints.

Any idea what’s going on?


(vipsoft) #2

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


(Matthieu Aubry) #3

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


(vipsoft) #4

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


#5

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?