Crontab in Laravel

I have a Laravel application built on top of Docker linked to AWS ECS. The application is dockerized, and I wish to run crontab on that application


Are you using laravels internal scheduler?

If so, i just run “php artisan schedule:work &” before the main application/apache starts in my entrypoint script

1 Like

We are using crontab:

          • /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1

But as far as I have understood, crontab will not get effective unless it is executed by some supervisor or service (i.e. docker-compose). Is that right?

docker-compose is a way of managing your containers, instead of using “docker run”, you can use compose to make a recipe of your container, so you dont have to remember your docker run command.

The supervisor part is true though, what docker does, is that it starts 1 application when it starts, it could be apache, but it could also be something like supervisor, and then supervisor spawns cron and apache.

There is some examples of this here or i made an complete example here

1 Like