How can I Install a Cron Scheduler on Magento?


You mean the scheduler extension?

If yes, then you can download the zip from github from the link: https://github.com/AOEpeople/Aoe_Scheduler

Extract and paste the files and folder to your magento root.

| improve this answer | |
  • Just the app folder? Also what I ultimately want to do is run a new cron job to clear cache every 12 hours. How can I do that? – DevAnd May 15 '18 at 15:01
  • you can use reference from here : magento.stackexchange.com/questions/84186/… – Ankit Shah May 15 '18 at 15:10
  • you can use "0 */12 * * *" expression to run the cron every in every 12 hours – Ankit Shah May 15 '18 at 15:12
  • So once I implement the full module on my server. What should I do? What commands should I run? – DevAnd May 15 '18 at 15:17
  • So I added the 3 files on my server... What should I do now? – DevAnd May 15 '18 at 15:39

It is still abstract in the way that you don’t really run jobs directly, instead, you use cron syntax to setup periodical method execution via Magento scheduler that works on top of system’s cron utility.

enter image description here

First you need crontab.xml inside your custom module:

<?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default"> <!-- Doesn't need to be unique -->
    <job name="cron_example" instance="[VendorName]\[ModuleName]\Cron\Example" method="execute">

Configuration above is to make sure that every minute, [VendorName][VendorName]\Cron\Example:execute() is run which would (according the code below log it’s name every minute.)

namespace VendorName\VendorName\Cron;
class Example {

protected $_logger;

public function __construct(\Psr\Log\LoggerInterface $logger) {
    $this->_logger = $logger;

public function execute() {
    return $this;

and then ::

magento cron:run [--group="cron_group_name"]
| improve this answer | |
  • What I ultimately want to do is run a new cron job to clear cache every 12 hours. How can I do that? I am running Magento – DevAnd May 15 '18 at 15:05
  • Okay here is a example for cron job to clear cache, which will help you. – Aditya Shah May 15 '18 at 15:08
  • you can pass the method in php fine, on above example which i posted. Mage::app()->cleanCache(); – Aditya Shah May 15 '18 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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