PHP CLI cron job not working

Permalink
I've tried setting up a cron job as shown in this howto:http://www.concrete5.org/documentation/how-tos/developers/using-con...

When I run the file directly from the command line, it works fine.

However if I put it in a cron job like this:
10 19 * * * /usr/bin/php /home/xyzacc/public_html/cli/myjob.php >> home/xyzacc/public_html/cli/myjob.log
, it fails to run and logs a warning "Access denied. CLI only".

How do I run it as a cron job?

BlueFractals
View Replies: View Best Answer
Mainio replied on at Permalink Best Answer Reply
Mainio
You'll need to call the job URLs you can see from the dashboard with wget for instance.

Alternatively, we have some command line tools that allow you to run these scripts straight from command line within the concrete5 context. I just put them to github, you can find them here:
https://github.com/ahukkanen/c5_cmd...

The wget method should serve most situations. The command line tools were initially for scripts that take or might take a long time, like importing 100s of thousands of database entries.
BlueFractals replied on at Permalink Reply
BlueFractals
I tried wget in cron but it's not working.

I even tried wget and curl in command line and both of them are giving me Access Denied warning:
wget http://www.mysite.com/index.php/tools/required/jobs/run_single?auth=217d9d6725d415507bcb19faf64d615e&jID=3
curl http://www.mysite.com/index.php/tools/required/jobs/run_single?auth=217d9d6725d415507bcb19faf64d615e&jID=3


Is there something else I need to do to make this work?
Mainio replied on at Permalink Reply
Mainio
You need to wrap the URLs into quotes since they contain ampersands.
BlueFractals replied on at Permalink Reply
BlueFractals
Oh yes. That works now.
Also thanks for the scripts.