![]() |
|
sfDoctrineCronManagerPlugin - 0.9.2symfony cron plugin |
|
![]() |
5
users
Sign-in
to change your status |
Allows users to administer cron jobs from a backend interface. Useful for users with limited admin access to the server. Jobs can be added, deleted, or run at any time for testing or other purposes. |
Allows users to administer cron jobs from a backend interface. Useful for users with limited admin access to the server. Jobs can be added, deleted, or run at any time for testing or other purposes.
In addition to standard cron functionality, this plugin allows the user to suppress the execution of a cron job if the current one minute load average exceeds a value set by the user. This can prevent system resource-intensive tasks from running, allowing them to be delayed until server load is better able to manage.
| Name | Status | |
|---|---|---|
|
|
lead | moc.liamg <<ta>> lemerts.bob |
Copyright (c) 2011 Bob Stremel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Version | License | API | Released |
|---|---|---|---|
| 0.9.7beta | MIT license | 0.9.7beta | 20/02/2012 |
| 0.9.6beta | MIT license | 0.9.6beta | 19/02/2012 |
| 0.9.5beta | MIT license | 0.9.5beta | 28/04/2011 |
| 0.9.4beta | MIT license | 0.9.4beta | 21/03/2011 |
| 0.9.3beta | MIT license | 0.9.3beta | 26/02/2011 |
| 0.9.2beta | MIT license | 0.9.2beta | 26/02/2011 |
| 0.9.1beta | MIT license | 0.9.1beta | 25/02/2011 |
| 0.9.0beta | MIT license | 0.9.0beta | 21/01/2011 |
| Version | License | API | Released |
|---|---|---|---|
| 0.9.7beta | MIT license | 0.9.7beta | 20/02/2012 |
| 0.9.6beta | MIT license | 0.9.6beta | 19/02/2012 |
| 0.9.5beta | MIT license | 0.9.5beta | 28/04/2011 |
| 0.9.4beta | MIT license | 0.9.4beta | 21/03/2011 |
| 0.9.3beta | MIT license | 0.9.3beta | 26/02/2011 |
| 0.9.2beta | MIT license | 0.9.2beta | 26/02/2011 |
| 0.9.1beta | MIT license | 0.9.1beta | 25/02/2011 |
| 0.9.0beta | MIT license | 0.9.0beta | 21/01/2011 |
The sfDoctrineCronManagerPlugin provides backend administration capabilities for
cron jobs. This is useful if developers have limited access to the production server
but still need to schedule, modify, or run cron jobs without server access.
Install the plugin (via a package)
symfony plugin:install sfDoctrineCronManagerPlugin
Install the plugin (via a Subversion checkout)
svn co http//svn.symfony-project.com/plugins/sfDoctrineCronManagerPlugin/trunk plugins/sfDoctrineCronManagerPlugin
Activate the plugin in the config/ProjectConfiguration.class.php
class ProjectConfiguration extends sfProjectConfiguration { public function setup() { $this->enablePlugins(array( 'sfDoctrinePlugin', 'sfDoctrineCronManagerPlugin', '...' )); } }
Rebuild your model
symfony doctrine:build-model
symfony doctrine:build-sql
Update you database tables by starting from scratch (it will delete all the existing tables, then re-create them):
symfony doctrine:insert-sql
or do everything with one command
symfony doctrine-build-all-reload frontend
or you can just create the new tables by using the generated SQL
statements in data/sql/schema.sql for the sf_cron_manager_job table.
As another alternative, you can run
symfony doctrine:generate-migrations-diff
and use the resulting file to migrate an existing implementation.
Enable the module in the settings.yml file for your backend application:
all:
.settings:
enabled_modules: [default, ..., sfCronManager]
Clear your cache
symfony cc
Finally, you must configure your server to call the new plugin each minute. This will run all other jobs in turn. To configure this, add the following to your crontab:
* * * * * php /path/to/symfony/project/symfony cron:go
Configure cron jobs in a familiar manner, using standard cron syntax
Take advantage of additional features not found in the cron package, described below
Certain jobs are processor-intensive and can drag a server down. If cron blindly continues to run these processes it has the potential to take the server down, or make the user experience very poor. The ability to suppress a cron job based on the current server load is an improvement beyond the capabilities of cron.
Set the limit as necessary within the job interface. This limit is numerical and corresponds to a one-minute load given by the linux uptime command. If this limit is exceeded when the job is due to run, it will be suppressed. Obviously, this could lead to the job continually being suppressed and never running as a result. For this reason, we can set a limit for how many times the job is suppressed.
This can be used to limit the number of consecutive times a job is suppressed. This is set, by default, to a value of three. If the job is suppressed more than three times, the job will be run regardless, and the current suppressed run counter will be reset to zero. This ensures that the job cannot be permanently suppressed, but allows us to schedule non-critical jobs to off-peak periods.
If the server goes down for an extended period of time, certain jobs may not run. Rather than look through the cron commands and calculate which jobs need to be run by hand, this setting will ensure that any job that was missed will be run automatically when the server is again running normally. This can be done because each time a job runs, the next run time is calculated and stored. Checking the next run time of each job allows this feature to run missed jobs.
Open your project's backend and visit /sfCronManager, then click the New link.
Provide the following information:
If the job will run at a future date, you may click the Run Now option in the Actions column when looking at the jobs list. This will allow you to test.
This plugin provides a task to review all jobs and run those that are due based on the current time. The cron:go task, configured during installation, will run all jobs. If you happen to know the ID of the job you wish to run, which is simply the database ID of the job record, you may run it directly using the command:
symfony cron:go [task_id]
fri, while valid cron syntax, will not work.