I have a question regarding Magento.

Apparently, to perform scheduled tasks within Magento, it needs to run a script called cron.php. Originally the script was triggered by an on-server crontab using the line wget -O /dev/null http://www.example.com/cron12345.php.

Unfortunately, due to some problems, we need to limit the life of the PHP FPM child processes to 300 seconds... and that murdered the PHP process running cron.php.

I tried running cron.php from CLI using the command php -c /etc/php5/fpm/php.ini cron.php and it seemed to work... but there were no output and the script just keeps running...

So my questions:

  1. Is cron.php a one-shot script, or does it run until completion and needs to be invoked again?
  2. If it needs to be regularly invoked (via cron), can I just add a crontab like the following:
*/15 * * * * cd /var/www/website && php -c /etc/php5/fpm/php.ini cron.php

Thank you for your kind assistance.

  1. It should finish, it can take some time especially if you didn't run it in a while.
    But generally it will finish. If it doesn't you'll need to check what is going on.

  2. Yes, that is how this is generally done, see:

  • Omigosh, apparently I accidentally added "-d" before cron.php ... no wonder it seems to be just stuck there --__-- ... thank you for the answer! – pepoluan Jun 17 '15 at 11:07

In the above code, you have declared the version of our module and the model class. The important part is the element. I use it to configure the cron job. here you will find the full guide: https://www.cloudways.com/blog/setup-magento-cron-job/

  • 1
    Welcome to Server Fault! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Gerald Schneider Jul 24 '17 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.