{"id":607,"date":"2019-09-23T12:55:25","date_gmt":"2019-09-23T12:55:25","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/09\/23\/configure-magento-cron-job\/"},"modified":"2025-07-21T16:14:19","modified_gmt":"2025-07-21T10:44:19","slug":"configure-magento-cron-job","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/configure-magento-cron-job\/","title":{"rendered":"How to Configure Magento Cron Job"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Magento offers the facility to schedule repetitive tasks automatically such as to send emails, newsletters, currency rate updates, log cleanups, google site map generation, and more.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As many merchants are still using Magento 1, the solution may be helpful to them to save themselves from such tasks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Commands for Magento Cron:<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Magento 1.x<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;php]sh \/path\/to\/your\/magento\/site\/root\/cron.sh &#91;\/php]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Magento 2.x<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Magento 2.x<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Refer <a href=\"https:\/\/meetanshi.com\/blog\/set-cron-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Set Cron in Magento 2<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, note that you need to change the \/path\/to\/magento\/root\/folder to the path of your website\u2019s default folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You have the option to run cron via your store URL in Magento 1.x, however, it is not recommended. Doing so causes issues with running multiple cron process simultaneously resulting in performance troubles or task may not be completed successfully.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Add a New Cron Task via SSH<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in to the server via SSH<\/li>\n\n\n\n<li>Run <em>crontab -e <\/em>command to add a cron task<\/li>\n\n\n\n<li>You can add or edit the cron task in the text editor<\/li>\n\n\n\n<li>Add the following record:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;php]*\/5 * * * * sh \/path\/to\/magento\/root\/folder\/cron.sh&#91;\/php]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do note that you need to add your own default folder path.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5. Save <br>6<em>. crontab -l<\/em>&nbsp;command will show the newly created task.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Add a New Cron Task via Cpanel<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Log in to your site\u2019s configuration panel at http:\/\/yourmagentosite.com:2082\/ or https:\/\/yourmagentosite.com:2083\/. <br>2. Enter cron into the search field to see the Cron jobs option in the Advanced section.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/10\/1_Configure-Cron-Job-in-Magento.png\" alt=\"Configure cron job in Magento\" class=\"wp-image-6545\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3. Enter the Email address in the Cron Email section which is used to send cron messages in case of any issues.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/10\/2_Configure-Cron-Job-in-Magento.png\" alt=\".png October 3, 2019 23 KB 1281 by 910 pixels Edit Image Delete permanently\" class=\"wp-image-6547\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4. Schedule the cron job and the command to be run.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" data-id=\"48036\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/09\/123.png\" alt=\"Common settings\" class=\"wp-image-48036\"\/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5. Click \u201cAdd New Cron Job\u201d button to complete the configuration.<br>Now that you are done with the cron job configuration, you can check the <em>cron_schedule <\/em>table of the Magento database to see the changes. The changing content is the indication of configuring the Magento cron correctly. <a href=\"https:\/\/meetanshi.com\/blog\/dynamically-schedule-cron-job-in-magento-2-system-configuration\/\">Dynamically Schedule Cron Job in Magento 2 System Configuration<\/a> if you require to backup your whole store based on the hours.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/09\/4.png\" alt=\"Add New Cron Jo\" class=\"wp-image-6472\" style=\"object-fit:cover\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Do not attempt to manually change the database table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequency to set the Magento Cron Job:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It is a good practice to run a cron job every 5 minutes for a mid-size Magento store. It may vary as per the requirement from one hour to one minute, however, 5 minutes is my recommendation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When you set up Magento cron job for 5 min via SSH, the command is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*\/5 * * * * \/usr\/bin\/php \/path\/to\/magento\/root\/folder\/bin\/magento cron:run | grep -v \"Ran jobs by schedule\" &gt;&gt; \/path\/to\/magento\/root\/folder\/var\/log\/magento.cron.log<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>*\/5 * * * * \/usr\/bin\/php \/path\/to\/magento\/root\/folder\/update\/cron.php &gt;&gt; \/path\/to\/magento\/root\/folder\/var\/log\/update.cron.log\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>*\/5 * * * * \/usr\/bin\/php \/path\/to\/magento\/root\/folder\/bin\/magento setup:cron:run &gt;&gt; \/path\/to\/magento\/root\/folder\/var\/log\/setup.cron.log<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That was all you need to know about the Magento cron job configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, while doing so, there are certain things you need to take care of such as permissions for \/path\/to\/magento\/root\/folder\/cron.sh file. The permission set for the file should allow the execution of the command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, check if the correct Email address is used in MAILTO. It is necessary because any issues with the cron job and the help for it is sent to this Email ID.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento offers the facility to schedule repetitive tasks automatically such as to send emails, newsletters, currency rate updates, log cleanups, google site map generation, and&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-607","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=607"}],"version-history":[{"count":2,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/607\/revisions"}],"predecessor-version":[{"id":18786,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/607\/revisions\/18786"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}