sfTaskTrackerPlugin - 0.0.6

Monitor wether certain regular tasks, for example cron jobs, have been run recently.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfTaskTrackerPlugin

You have to define the tasks, which should be tracked, in your configuration. Furthermore you define a maximum interval since the last execution for each task.

If you have included the partial sfTaskTracker/alert into your admin section, it will report a failure as soon as the last execution time of a task is older than the configured maximum interval since last execution. Thus you can always be sure, that regular tasks (cron jobs) are running.

Installation

  • Install the plugin

    $ symfony plugin-install http://plugins.symfony-project.com/sfTaskTrackerPlugin
    
  • Rebuild your model

    $ symfony propel-build-model
    $ symfony propel-build-sql
    
  • Update you database tables by starting from scratch (it will delete all the existing tables, then re-create them):

    $ symfony propel-insert-sql
    

    or you can just create the new tables by using the generated SQL statements in data/sql/plugins.sfTaskTracker.lib.model.schema.sql

  • Clear you cache

    $ symfony cc
    
  • Include the sfTaskTracker/alert partial on your Admin Control Panel index page. It does not show anything till a problem with the tasks has been found.

Configuration

Define an array of tasks you want to track in config/ProjectConfiguration.class.php, in the setup() method. The index of each element is the name of the task and the integer value is the number of seconds that can pass till the sfTaskTracker/alert partial shows an alert.

public function setup()
{
    sfConfig::set('track_tasks', array(
      'myCleanTask' => 4000,
      'myBackupTask' => 90000
    ));
  • This example configuration expects that myCleanTask is run hourly (every 3600 seconds) and does not run more than 400 seconds. Thus an alert is shown as soon as the task has not been run since 4000 seconds or has not been finished since 4000 seconds.

  • The backup task is run daily (86400 seconds) and shouldn't take longer than 90000-86400 seconds.