Magento2 Cron – How to Check if a Cronjob is Already Running

cronmagento-cronmagento2

What is the best way to check, if a cronjob is already running?

I need a cronjob that checks, if there are new files in a folder and then do some stuff to this files. The cronjob should check every minute for new files. The problem is, that the cronjob itself could need more than one hour to execute.

How can i avoid to execute a cronjob multiple times?

Best Answer

Run the following command to see if crons are running:

service cron status

Or check the following table to see which cronjobs are running (empty (truncate!) the table and see if it get's repopulated to check if your crons are running the way you want it):

cron_schedule
Related Topic