cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with execution of cron Magento 2.4.3 - Cron execute twice!

Problem with execution of cron Magento 2.4.3 - Cron execute twice!

I have problems running cron on Magento 2.4.3

 

My crontab is configured in this way:

#~ MAGENTO START ebd31839b0ed05bdb6ca8efa81d9bd8cc8bb1f90bbec3b545ed65991c8a7d49a
*/5 * * * * /usr/bin/php /home/www/maisondudesign.it/htdocs/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /home/www/maisondudesign.it/htdocs/var/log/cron/magento.cron.log
#~ MAGENTO END ebd31839b0ed05bdb6ca8efa81d9bd8cc8bb1f90bbec3b545ed65991c8a7d49a

My Magento configuration is:

Generate Schedules Every - 5
Schedule Ahead for - 20
Missed if Not Run Within - 60
History Cleanup Every - 60
Success History Lifetime - 60
Failure History Lifetime - 600
Use Separate Process - No

My cronjob is configurated like this:

<group id="default">
        <job instance="Homemania\CustomFunction\Cron\LoadFunction" method="execute" name="import_wisigo_apply_all">
            <schedule>*/5 * * * *</schedule>
        </job>
    </group>

After 5 minutes, the job fails and a new job starts.

 

The initial job however is still continuing its execution and therefore I find myself with two jobs that are running.

 

I put logs and saw that the initial job is continuing to run.

 

I checked the cron.log file and in general if there are any error logs but I could not find anything.

 

How can I make magento not mark my job as failed and then keep it running without starting another?

 

Thanks,

 

Andrea

1 REPLY 1

Re: Problem with execution of cron Magento 2.4.3 - Cron execute twice!

To Check the cron functionality use one of the controller class and put the cron code

and hit that controller in this way you can debug the cron so that you don't have to wait for the schedular to run. You can use var_dump() or print_r() to debug it.