Skip to content

Instantly share code, notes, and snippets.

@rakeshkumar125
Created September 23, 2016 14:06
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 rakeshkumar125/cf5c52d28f7be2160f046577a844def7 to your computer and use it in GitHub Desktop.
Save rakeshkumar125/cf5c52d28f7be2160f046577a844def7 to your computer and use it in GitHub Desktop.
<?php
if (PHP_SAPI === 'cli') {
require("cronLockHelperClass.php");
if (($pid = cronHelper::lock()) !== FALSE) {
// here need to apply the logic
cronHelper::unlock();
} else {
echo "cron already running...";
}
} else {
die("Oops run from command line please...");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment