{"id":179,"date":"2018-09-12T12:05:10","date_gmt":"2018-09-12T12:05:10","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2018\/09\/12\/set-cron-in-magento-2\/"},"modified":"2025-07-23T09:39:35","modified_gmt":"2025-07-23T04:09:35","slug":"set-cron-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/set-cron-in-magento-2\/","title":{"rendered":"How to Set Cron in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Magento 2 facilitates the feature of cron job that allows to schedule activities ahead of time and thus automates them, saving our time! Some of the examples where an admin needs to <i><strong>set Cron<\/strong><\/i>&nbsp;<i><strong>in Magento 2<\/strong><\/i> are reindexing, generating Google sitemaps, customer notifications, updating currency rates, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get rid of doing important periodic tasks manually. Automate such tasks in your stores by configuring cron job in Magento 2.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">There are two methods to set cron in Magento 2:<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>From SSH<\/strong> &#8211; Open SSH as root user and type <strong>crontab -e<\/strong> and add the below commands.<\/li>\n\n\n\n<li><strong>From cPanel<\/strong> &#8211; Cron can be set directly from cPanel by adding the below commands.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Add the Following Commands to Set Cron in Magento 2<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>* * * * * \/usr\/bin\/php \/var\/www\/magento2\/bin\/magento cron:run | grep -v \"Ran jobs by schedule\" &gt;&gt; \/var\/www\/magento2\/var\/log\/magento.cron.log\n* * * * * \/usr\/bin\/php \/var\/www\/magento2\/update\/cron.php &gt;&gt; \/var\/www\/magento2\/var\/log\/update.cron.log\n* * * * * \/usr\/bin\/php \/var\/www\/magento2\/bin\/magento setup:cron:run &gt;&gt; \/var\/www\/magento2\/var\/log\/setup.cron.log<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it! Now you may relax while your job gets done automatically. You can also <a title=\"How to Dynamically Schedule Cron Job in Magento 2 System Configuration\" href=\"https:\/\/meetanshi.com\/blog\/dynamically-schedule-cron-job-in-magento-2-system-configuration\/\" target=\"_blank\" rel=\"noopener\">dynamically schedule cron job in Magento 2 system configuration<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank You!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2 facilitates the feature of cron job that allows to schedule activities ahead of time and thus automates them, saving our time! Some of&#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-179","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/179","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=179"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/179\/revisions"}],"predecessor-version":[{"id":19092,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/179\/revisions\/19092"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}