TIP 05 / 06

Keep Scheduled Tasks Safe Across Multiple Servers.

When every server runs Laravel's scheduler, use onOneServer() to elect one runner and withoutOverlapping() to prevent a slow execution from starting again before it finishes:

php
Schedule::command('reports:rebuild')
    ->hourly()
    ->onOneServer()
    ->withoutOverlapping(30);

All scheduler instances must share a cache store that supports atomic locks. Set the overlap expiration to fit the task's maximum runtime and monitor the task if it approaches that limit.