I am trying to implement cron job to write a log file with 1min interval. I have an issue while doing the same. I notice that cron job is not running automatically.

Each time when I run "PHP bin/Magento cron: run " then only cron job gets executed and the database gets populated. If each time I need to run that command then it does not serve as the purpose of corn job.

I follow this link to implement:


Please help me for the same

  • have you configured cron in crontab?
    – kunj
    Commented Aug 2, 2018 at 11:53
  • Yes I did it.I made crontab.xml in "etc" and .php in the Cron folder Commented Aug 2, 2018 at 11:58
  • Did you manage to fix it?
    – Raül
    Commented Aug 2, 2018 at 12:13
  • @RaülVila I am executing the command that you mentioned below Commented Aug 2, 2018 at 12:14
  • I typed crontab -e but I dont see anything inside it Commented Aug 2, 2018 at 12:23

2 Answers 2


Try this:

just run this command in terminal crontab -e then paste below code in terminal.

* * * * * <path to php binary> <magento install dir>/bin/magento cron:run 

After pasting that code press CTRL + X key then you will see this message.

Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?

Now press Y now you will see this type of message.

File Name to Write: /tmp/{{you will see temp name}}/crontab Just press ENTER And cron set.

It will call every minute Magento cron and Magento will manage your extension's cron and run as per configured time.

After cron configuration you just need to flush the cache.

  • Welcome happy to help you
    – kunj
    Commented Aug 2, 2018 at 12:48
  • I have another query. In php file I extend \Psr\Log\LoggerInterface.Is it possible to do some other task not related to log? Commented Aug 3, 2018 at 6:16
  • not getting you.
    – kunj
    Commented Aug 3, 2018 at 6:17
  • I mean to say, I have a Logegr.php file which has a execute method and this execute method runs each time when cron run and write some "hello" in system.log file.And this .php file is same as mentioned in magento devdocs.Now I want to do some other task like log cleaning. Commented Aug 3, 2018 at 6:23
  • yes you can write your custom method at method="execute" and create same method in your php file.
    – kunj
    Commented Aug 3, 2018 at 8:43

Make sure all the paths are properly written and there are no extra spaces or anything like that:

In the CLI type: crontab -e and you should see your crons:

* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log

You can run:

php bin/magento setup:upgrade
php bin/magento index:reindex
php bin/magento cache:flush

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.