DEV Community

AutoIdle
AutoIdle

Posted on • Originally published at Medium on

Run Laravel scheduled jobs on Heroku

Laravel on Heroku — Tip #3

Photo by Sonja Langford on Unsplash

Heroku has the free Heroku Scheduler, but this has two disadvantages:

  • it runs only every 10 minutes, every hour, or every day
  • you have to add your commands in there UI

Laravel comes with an amazing Task Scheduler.

To run Laravel scheduled jobs on Heroku you have to add a new command and run that as a process.

Create the Command app/Console/Commands/SchedulerDaemon.php:

You can generate this file with:

php artisan make:command SchedulerDaemon

Add the following line to your Procfile:

Don’t forget to enable this process in the Heroku Dashboard:

Enable this process in the Heroku Dashboard

Drop Me a Line

Thanks for reading! Say hi to me on Twitter and check out our Heroku Addon to save money by automatically shutting down your non-critical dynos.

Discussion (1)

Collapse
brojenuel profile image
Jenuel Oras Ganawed

wait its not free?