Prevents two of the same cronjobs from running at the same. It is useful with cron to make sure that a job doesn't run before a previous one has finished.
This script is a port of the original solo bash script written by Tim Kay. It has been ported to PHP to make it available on Windows servers.
Add the following to your composer.json.
{
"require": {
"bashaus/solo-php": "dev-master"
},
"config": {
"bin-dir" : "bin"
}
}
bin/solo [port] [exec*]
- Argument
port
is an arbitrary port number to lock - Argument
exec
is a shell command to run
You can use it with cron like this:
* * * * * cd ...; bin/solo 24601 ./task.php arg1 arg2 arg3
The script task.php run every minute, but only if the previous invocation has finished. You can use any parameters, it doesn't have to run it every minute.
Take a look at Tim Kay's documentation for more use cases and how to use solo.
- Tim Kay - Original concept
- Bashkim Isai - PHP port
If you fork this project and create a pull request add your GitHub username, your full name and website to the end of list above.