Skip to content

vladfr/php.cronlock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

php.cronlock
This class implements cronjob locking to prevent concurent processes from running.
Locks are kept on the filesystem.

Setup:
You need to include config.php inside this directory in your cron job file.

Usage: You need to wrap your entire cron job like this:
if(lock::lock() !== FALSE){
	//execute your job here
	lock::unlock();
}

Use lock::getData() and lock::setData() to get and set persistent data for the lock pid.
Data is saved only on a successful lock-unlock process. If you want to save it in other cases use lock::saveData();
If you want to delete all data associated with a lock pid, just set the pid, then call lock::delData();

About

Easy file locking system for your daily crons. Written in PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages