2017 © Pedro Peláez
 

symfony-bundle cron-bundle

Symfony cron

image

cron/cron-bundle

Symfony cron

  • Friday, July 27, 2018
  • by NoUseFreak
  • Repository
  • 5 Watchers
  • 31 Stars
  • 44,773 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 23 Forks
  • 6 Open issues
  • 17 Versions
  • 21 % Grown

The README.md

Cron Bundle

Packagist Build status Packagist License, (*1)

Cron integration for symfony., (*2)

Installation

Installing this bundle can be done through these simple steps:, (*3)

  1. Add the bundle to your project as a composer dependency:
composer require cron/cron-bundle
  1. Add the bundle to your application kernel:
// app/AppKernel.php
public function registerBundles()
{
    // ...
    $bundle = array(
        // ...
        new Cron\CronBundle\CronCronBundle(),
    );
    // ...

    return $bundle;
}
  1. Update your DB schema
bin/console make:migration
bin/console doctrine:migrations:migrate
  1. Start using the bundle:
bin/console cron:list
bin/console cron:run
  1. To run your cron jobs automatically, add the following line to your (or whomever's) crontab:
* * * * * /path/to/symfony/install/app/console cron:run 1>> /dev/null 2>&1

OR If you don't have a dedicated cron daemon (e.g. in Heroku), you can use:, (*4)

bin/console cron:start # will run in background mode, use --blocking to run in foreground
bin/console cron:stop # will stop the background cron daemon

Available commands

list

bin/console cron:list

Show a list of all jobs. Job names are show with [x] if they are enabled and [ ] otherwise., (*5)

create

bin/console cron:create

Create a new job., (*6)

delete

bin/console cron:delete _jobName_

Delete a job. For your own protection, the job must be disabled first., (*7)

enable

bin/console cron:enable _jobName_

Enable a job., (*8)

disable

bin/console cron:disable _jobName_

Disable a job., (*9)

run

bin/console cron:run [--force] [job]

which we borrowed from Symfony. Make sure to check out php-cs-fixer as this will help you a lot. Please note that --force forces the job to be executed (even if disabled) based on the job schedule, (*10)

run now, independent of the job schedule

bin/console cron:run --schedule_now [--force] job

run in non-cli contexts (i.e. from a controller)

bin/console cron:run --script-name='bin/console'

start

bin/console cron:start [--blocking]

Start the cron as a daemon. By default it forks itself to the background and suppresses any output. The --blocking option will keep it in the foreground and will display output. This is useful when you don't have a dedicated cron daemon (e.g. on Heroku)., (*11)

stop

bin/console cron:stop

Stops the background cron daemon started with cron:start. This is not applicable when the daemon was started with --blocking., (*12)

If you would like to help, take a look at the list of issues., (*13)

Requirements

PHP 5.5.9 or above, (*14)

Author and contributors

Dries De Peuter - dries@nousefreak.be - http://nousefreak.be, (*15)

See also the list of contributors who participated in this project., (*16)

License

CronBundle is licensed under the MIT license., (*17)

The Versions