Question

I am trying to run a PHP script via a cron job on a Jelastic server. My cron/apache file looks like this.

*/1 * * * * /usr/bin/php /var/www/webroot/ROOT/php/cron.php

(there is a blank line after the last cronjob entry)

However the script is not called by the cron job. I have read the Jelastic documentation for cron jobs (http://docs.jelastic.com/cron-job) but this hasn't helped me resolve the issue.

Any help would be appreciated.

Was it helpful?

Solution

As you said the script is accessible by HTTP, you could try using this cron job instead:

*/1 * * * * wget -q http://www.example.com/cron.php

This will perform at GET request to the cron.php file and disregard the output.

OTHER TIPS

You can already get SSH access on the Layershift Jelastic PaaS: http://kb.layershift.com/jelastic-ssh-access

Assuming you're using a different provider, you might try writing cron output to a log file like

*/1 * * * * /usr/bin/php /var/www/webroot/ROOT/php/cron.php >> /var/log/httpd/cron.log

And/or you can try to mail the output to yourself (but beware mailing caveats; without a public IP your mail will "originate" from the physical server's IP instead, and that may or may not have a valid PTR record defined or be on blacklists etc. - so basically there's a good chance your spam filters may reject the email); just add this line to your crontab:

MAILTO=you@youremail.com

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top