ffreitas-br / command-lock-bundle
Symfony bundle who create a lock in commands, avoiding the execution of same command simultaneously
Installs: 2 527
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 3
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.4.0
- symfony/symfony: 2.5.*@stable
Requires (Dev)
- phpunit/phpunit: 4.1.*@stable
This package is not auto-updated.
Last update: 2025-03-01 17:54:50 UTC
README
This command-lock-bundle
when installed prevents two or more of same command runs simultaneously.
Installation
To install command-lock-bundle
you will need just a few minutes.
- Include the
command-lock-bundle
in therequired
section ofcomposer.json
.
composer.json
// ... "require": { "ffreitas-br/command-lock-bundle": "dev-master", }, // ...
After this run composer update
or composer intall
to refresh your dependencies.
- Register the bundle in your Kernel.
app/AppKernel.php
<?php public function registerBundles() { $bundles = array( // ... new FFreitasBr\CommandLockBundle\CommandLockBundle(), ); // ... }
- Configure the directory where the pid lock files will be stored.
app/config/config.yml
... command_lock: pid_directory: "%kernel.root_dir%/data/command_pid_files" ...
Don't worry
if you don't have the directories created yet, the bundle will take care of this for you.
- [OPTIONAL] Configure a list of exceptions.
app/config/config.yml
... command_lock: exceptions: - cache:warmup - cache:clear ...
The commands listed in this configurations will be allowed to run simultaneously.
Now you have the command-lock-bundle
installed and configured, it will now prevents two or more of same command runs simultaneously.