Concrete5 Job via CRON access denied

Permalink
Hi there.

I'm attempting to run a C5 job through CRON. I'm using a wget command to the URL provided in the C5 admin. However, when I test the command via SSH through the terminal, I get "Access Denied" because the "C5_EXECUTE" variable is not set. As far as I understand, this variable is set when you log into C5 but how am I supposed to ensure these variables are set, etc. if I'm executing through CRON?

stephendmalloy
 
stephendmalloy replied on at Permalink Reply
stephendmalloy
Anyone?

I'm still having this issue. When I visit the CRON job URL in my web browser I'm able to have it run. However, when I use an actual command via terminal or through CRON itself I get "Access Denied" because C5_EXECUTE is not defined.

Curious if anyone else has ran into this.
adaptive replied on at Permalink Reply
adaptive
Sorry for replying on an old post, but I had a similar problem and solved it in a different way.

I was using lynx instead of wget to run sitemap generator, e.g.:
lynx -dump http://domain.tld/index.php/tools/required/jobs/run_single?auth=15746f3ba67718f29e4720d2b030f3af&jID=3

This gave 'Access denied' as you had found. But the problem was that the URL parameter needed to be wrapped in quotes, thus:

lynx -dump "http://domain.tld/index.php/tools/required/jobs/run_single?auth=15746f3ba67718f29e4720d2b030f3af&jID=3"

This produced the expected result and worked. The reason the first example did not work is due to the
&jID=3
being lost in the request. The same issue applies to wget.

The other suggested solution to create a command line entry point to C5 is valid and useful, but probably overkill for this particular failure mode.

Hope this helps others with this 'Access denied' issue.
JohntheFish replied on at Permalink Reply
JohntheFish
I think mkly published a howto about jobs setting a user for environment only purposes, so allowing access where jobs run into permissions code.
stephendmalloy replied on at Permalink Reply
stephendmalloy
John -

Thanks for your reply. I found this:

http://www.concrete5.org/documentation/how-tos/developers/using-con...

And it works!