How to Create a Cron Script in Magento

104 10
    • 1). Open the "app/code/core/Mage/CatalogRule/etc/config.xml" file for Magneto in Notepad or another text-based editor.

    • 2). Browse through the script for the "<crontab>" XML statement.

    • 3). Add the following code following the existing crontabs:

      <crontab>

      <jobs>

      <catalogrule_apply_all>

      <schedule><cron_expr>0 1 * * *</cron_expr></schedule>

      <run><model>tasktorun</model></run>

      </catalogrule_apply_all>

        </jobs>

        </crontab>

    • 4). Replace "0 1 * * *" with the time format for your cron to run, in the format of minutes, hours, date, month, day.

    • 5). Replace "tasktorun" with a script address for a task. For example, if you have a "/backup" script, type "/backup" in that field.

    • 6). Save the XML file.

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.