Home > Blockchain >  Symfony - Scheduling Tasks With Cron config file
Symfony - Scheduling Tasks With Cron config file

Time:10-21

I am running Symfony 5.0 application and I wrote two commands like:

class CheckCommand extends Command
{
    protected static $defaultName = 'on:approach:check';

    ....
}

When I trigger the command with:

php bin/console on:approach:check

everything I implemented works as expected.

What I want to accomplish is I want to run a scheduling tasks with cron that will execute this command every 3 minutes.. As I am in my local environment I want to run it locally.

I tried to find some better explanation of where I need to generate cron file in the project and put the command like:

* * * * *       cd /srv/www/football/current && php bin/console on:approach:check

My question was also where this file need to be stored and how should it be called regarding to Symfony project.

CodePudding user response:

you can try this :

*/3 * * * *      php /srv/www/football/current/bin/console on:approach:check >> /path/to/log/output.log

CodePudding user response:

This command has nothing to do with symfony.

You should place it in your OS layer.

  • Related