0

in my config.xml file have crontab

.....
    <crontab>
            <jobs>
                <autoreplenish_test>
                    <schedule>
                        <config_path>how to set up here database values</config_path>
                    </schedule>
                    <run>
                        <model>autoreplenish/replenish::run</model>
                    </run>
                </autoreplenish_test>
            </jobs>
        </crontab>
...
1
  • 1
    This answer may help you.
    – Ash
    Commented May 21, 2014 at 11:02

4 Answers 4

1

These links might help you out

http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job http://blog.belvg.com/magento-certified-developer-exam-setting-up-a-cron-job.html

3
  • it's better to add specified code because link may not be worked in future. Please add explain answer with code.
    – Ami Kamboj
    Commented Jun 21, 2014 at 17:29
  • You are correct, but in my opinoin it's not nice to copy some one else's work and put it here :) feel free to edit my answer..
    – Sukeshini
    Commented Jun 22, 2014 at 9:41
  • Actually my concern is that, you follow the correct code format here, not just copy or paste so that asking person get proper solution of his/her problem. it feel honest to copy or paste any one code but it also feel much good to find some way and modified it to help other one person. Thankyou
    – Ami Kamboj
    Commented Jun 22, 2014 at 9:44
1
        <crontab>
            <jobs>
                <autoreplenish_test>
                    <schedule>
                        <config_path>customsection/cronfield/cron_settings</config_path>
                    </schedule>
                    <run>
                        <model>autoreplenish/replenish::run</model>
                    </run>
                </autoreplenish_test>
            </jobs>
        </crontab>

this has worked for me!!

0

I think the best way to get this to work is to rewrite the Mage_Cron_Model_Schedule

<models>
    <your_module>
        <class>Your_Module_Model</class>
    </your_module>
    <cron>
        <rewrite>
            <schedule>Your_Module_Model_Schedule</schedule>
        </rewrite>
    </cron>
</models>

Then you would need to rewrite the function setCronExpr and update is so it tries to load the value from the database first and then defaults to the normal behaviour.

Note: You will have to check your xml back to cron_expr and what ever you store in the database should be a valid cron expression

See this question and answer combo for what is valid or not.

0

There are missing cron time interval on you code< i have set cron will run every 30mins interval

<cron_expr>30 * * * *</cron_expr>

more details http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job

<crontab>
<jobs>
<autoreplenish_test>
<schedule><cron_expr>30 * * * *</cron_expr></schedule>
<run><model>autoreplenish/replenish::run</model></run>
</autoreplenish_test>
</jobs>
</crontab>

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.