Skip to content

Instantly share code, notes, and snippets.

@cosmos-sajal
Created September 13, 2018 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosmos-sajal/6a74f3c99b03663153509cd2eee1be51 to your computer and use it in GitHub Desktop.
Save cosmos-sajal/6a74f3c99b03663153509cd2eee1be51 to your computer and use it in GitHub Desktop.
if ($this->lockHandlerUtil->isDuplicateInstanceRunning()) {
// trigger some kind of alert
return;
}
/*
actual cron code
....
....
*/
// the last line of the cron
// this will delete the file myCronPID.txt
// when the cron completes the execution
$this->lockHandlerUtil->releaseInstance();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment