Running Commandline Action "repeatedly"

Hello,

I wrote a Command Controller, that runs some background work for our application. The action is started every minute using a cronjob.

This works fine so long…

But…

Now I have two more requirements for this action:

1.) Now the action should not run every minute… It should run "repeatedly", so when it is ready, it should start over.

2.) The action is only allowed to run once at a time, so if the action is currently running, it should not run again.

How can I solve this using yii2, cronjobs and my command controller?

Thanks for your help,

Urkman

You should meet mutex ( https://github.com/yiisoft/yii2/tree/master/framework/mutex ).

It’s a nice guy that’s willing to help you for this requirement :D