3

I'm working on ubuntu. I've configured cron job in config.xml

 <crontab>
        <jobs>
            <my_cron>
                <schedule>
                    <cron_expr>*/1 * * * *</cron_expr>
                </schedule>
                <run>
                    <model>helloworld/observer::doSomething</model>
                </run>
            </my_cron>
        </jobs>
    </crontab>

and observer function is as follow

public function doSomething()
    {
        Mage::log("Ya", null, 'obs.log');

    }

After doing these settings, I don't see cron scheduled in cron_schedule table. When I run localhost/magento/cron.php file, cron is registered in cron_schedule table.

How I can configure it such that I don't have to run cron.php every time and cron schedule will be registered in cron_schedule table?

Also, I want to run it every 1 minute by using <cron_expr>*/1 * * * *</cron_expr> but in cron_schedule table it says, it's scheduled at 2015-07-15 04:57:00, which is not just a minute away.

3
  • 1
    Hi Amit, Have you configured crontab in your ubuntu?? Like by running crontab -e and 1 * * * * php -f magento-directory/cron.php Commented Jul 15, 2015 at 8:32
  • @GirishSH: not yet. If I run crontab -e, it says "no crontab for amit - using an empty one".
    – amitshree
    Commented Jul 15, 2015 at 8:53
  • Also I tried putting path in crontab 1* * * * /var/www/html/magento/cron.php
    – amitshree
    Commented Jul 15, 2015 at 9:27

1 Answer 1

1

If you want your cron job to run every minute then put this in the crontab:

* * * * * /bin/sh /var/www/html/magento/cron.sh

Also this is a nice reading I think could help you to set cron groups: https://magento.stackexchange.com/a/56375/5913

1
  • I tried * * * * * /bin/sh /var/www/html/magento/cron.sh and */1 * * * * /bin/sh /var/www/html/magento/cron.sh, still I don't see any entry in cron_schedule table.
    – amitshree
    Commented Jul 15, 2015 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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