cancel
Showing results for 
Search instead for 
Did you mean: 

Cron Jobs problem, please help

SOLVED

Cron Jobs problem, please help

I installed magento 2.3.3 via composer on my windows 10, MAMP.

 

Trying to configure cron jobs but have trouble.

 

Command cron:install not working on windows, so I'm trying to make cron jobs work by these commands:

 

php bin/magento cron:run >> C:/MAMP/htdocs/var/log/magento.cron.log
php update/cron.php >> C:/MAMP/htdocs/var/log/update.cron.log
php bin/magento setup:cron:run >> C:/MAMP/htdocs/var/log/setup.cron.log

 

But it seems that cron jobs run just once when I execute these commands and not works after.

 

Please help me.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Cron Jobs problem, please help

@tattoowizards  Cron are linux function. In windows you have scheduled job. You can achieve what you are looking for but it can be tricky. Sometime you have to create a dat or exe file to achieve the same. Below is a link has similar discussion and may help.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

View solution in original post

6 REPLIES 6

Re: Cron Jobs problem, please help

Hello @tattoowizards 

 

You can use the following command to run manual cron job in localhost
 
php bin/magento cron:run --group="default"
Also, if you want to set up a cron job in the live server, follow the solution at https://meetanshi.com/blog/set-cron-in-magento-2/
Hope it helps
---
If you've found my answer useful, please give"Kudos" and "Accept as Solution"

Re: Cron Jobs problem, please help

Thank you.

 

I already run this command as I mentioned in first post...

But this command is only runs cron jobs once.

 

It's not possible to properly adjust crons to run atumaticaly in windows, mamp?

Re: Cron Jobs problem, please help

@tattoowizards  Cron are linux function. In windows you have scheduled job. You can achieve what you are looking for but it can be tricky. Sometime you have to create a dat or exe file to achieve the same. Below is a link has similar discussion and may help.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: Cron Jobs problem, please help

Hello @tattoowizards

 

You can use the following command to run manual cron job in localhost

 

Step 1 :

Stores > Settings-Configuration. On the left menu, under the Advanced section, click System. Expand the section Cron (Scheduled Tasks))

    • Generate Schedules Every: 15
    • Schedule Ahead for: 20
    • Missed if Not Run Within: 15
    • History Cleanup Every: 10
    • Success History Lifetime: 60
    • Failure History Lifetime: 600

Step 2: Clear Cache in System > Cache Management.

TRUNCATE TABLE cron_schedule;

Step 3: php bin/magento cron:install

 

Steps 4: To check directly in the database 

SELECT MAX(executed_at) FROM cron_schedule

 Cron Log list of errors: SQL Query.

 

SELECT job_code, messages FROM cron_schedule WHERE messages IS NOT NULL

Re: Cron Jobs problem, please help

I already tried this.
But I'm on windows so "install" command is not working there ...

Re: Cron Jobs problem, please help

Scheduling to run a bat file as mentioned above is the best option for windows

you can also on schedule to run http(s)://yourhostname/cron.php instead if you can't schedule windows task, with services like https://www.easycron.com/

 

I'd recommend you switching to Linux if you can by any chance