Search code examples
cronkohanakohana-3cron-task

How does Kohana Minion Task?


Good afternoon! There is a site on the Kohana 3.3, which is done sending Email, sms, etc.

Such a question, if we are just 1 minute will launch the task (such as newsletter email), Minion Task allows to perform this task, if it is already running? For example, if it was not completed since the previous start-up and is currently executing?


Solution

  • Minion task has not that functionality.

    You have two options: 1. Lock the cron from linux: you can create a shell script that creates a lock file, run your task and delete the lock file at the end and before that check if the file exists to do nothing.

    1. Use some app context variable (i.e.: kohana file cache, database, etc) to create a flag for the task is running and check for this flag in your php code, add the flag if the process is not running and clear it after the process finished.

    Hope this help, let me know if you have aby doubt about this solution.