rauwekost/schedule-bundle

Symfony2 scheduler for commands

Installs: 308

Dependents: 0

Watches: 1

Open Issues: 1

Language: PHP

0.6.1 2015-02-12 14:28 UTC

README

Build Status

This bundle lets you create a cron based schedule to run symfony commands at a given time. The bundle is stil dependant on cron but instead of having a gazillion cron jobs you just define one and the scheduler will take care of the rest.

Installation

TBD

Schedule

#app/config/schedule.yml

monthly_cache_clear:
    command: "cache:clear"
    arguments:
        env:prod
    # "(minute) (hour) (day of month) (month) (day of week) (year[optional])"
    schedule: "00 00 1 * * *"
    exit_on_fail: false
    retry: false

daily_import:
    command: "import:something"
    arguments:
        somearg:3
    schedule: "00 12 * * * *"
    exit_on_fail: true
    retry: true
  • command
    Set the command string, including arguments !Warning don't use spaces in arguments like 'env = prod' always do: 'env=prod'
  • Schedule
    A cron formatted schedule
  • exit_on_fail
    If the scheduler should exit when this command fails
  • retry
    If the scheduler should retry until successfull

Todo and future imporvements

  • Add logging to keep track of completed and failed tasks.
  • Make it possible to run shell commands as well.