You added Schedule::command('reports:send')->dailyAt('7:00') to routes/console.php, deployed, and went home. The next morning there's no report. Or there are three, because the app runs on three servers and every one of them sent it.
Neither is a bug in the command. The Laravel scheduler is a list of tasks plus a check against the clock, and something outside Laravel has to run that check every minute, on the right number of machines, with the right locks. This guide covers the whole path for Laravel 13 (current as of November 2026, and the same in 11 and 12): the crontab line, the chain methods that decide what actually happens, queues, what Forge, Laravel Cloud and Vapor do for you, and a protected route an outside scheduler can call when you'd rather not run the clock yourself.
How the Laravel scheduler actually runs
The scheduler has two halves. The first is your schedule, written in PHP; in a Laravel 11, 12 or 13 app it lives in routes/console.php. The second is a process that runs php artisan schedule:run once a minute. That command boots the app, compares every task with the current time, runs what's due and exits. Nothing in Laravel wakes up on its own.
Here is a schedule for a typical SaaS: a nightly Stripe reconciliation, an hourly digest during office hours, and a weekly purge of expired carts.
<?php
use App\Jobs\ReconcileStripe;
use Illuminate\Support\Facades\Schedule;
// Nightly: hand the reconcile job to the queue
Schedule::job(new ReconcileStripe)
->dailyAt('4:15')
->onOneServer();
// Hourly digest, office hours on weekdays, New York time
Schedule::command('digest:send')
->hourly()
->weekdays()
->between('8:00', '18:00')
->timezone('America/New_York');
// Weekly cleanup, Sundays at 03:00
Schedule::command('carts:purge')
->weeklyOn(0, '3:00')
->withoutOverlapping();If you'd rather keep routes/console.php for command definitions, withSchedule() in bootstrap/app.php takes a closure that receives the same Schedule instance. Apps that started on Laravel 10 or earlier may still schedule in the schedule() method of app/Console/Kernel.php. The methods you chain are the same in all three places.
Then the clock. On a server you control it's one crontab line, straight from the Laravel scheduling docs:
* * * * * cd /var/www/app && /usr/bin/php8.4 artisan schedule:run >> /dev/null 2>&1Everything that goes wrong with a PHP crontab line goes wrong here too: cron's short PATH finding a different php, the CLI reading its own php.ini, the line running as a user who can't write to storage/. The PHP cron jobs guide builds that line piece by piece, so this guide assumes it's in place. Laravel 13 needs PHP 8.3 or newer (support policy), so pin a versioned binary that meets it.
Build a schedule and see when it fires
Every task is a chain: what to run, how often, then constraints and modifiers. Build one below. The chain updates as you go, each method says what it does, the next runs are listed in the task's timezone, and the server counter shows what happens when the same code runs on more than one machine.
Laravel schedule builder
5 chained methods
use Illuminate\Support\Facades\Schedule;
Schedule::command('reports:send') ->dailyAt('7:00') ->weekdays() ->timezone('America/New_York') ->withoutOverlapping() ->onOneServer();Next runs in America/New_York
cron 0 7 * * 1-5
- Working out the next runs...
Servers running schedule:run
- web-1runs
- web-2skips
- web-3skips
Each due minute runs it once. The other 2 find the lock taken and skip.
Rather call a route on this clock from outside? Crontap takes the same cron and timezone.
Schedule thisCheck yours with php artisan schedule:list, which prints each task's cron and next due time.
Frequencies, constraints and timezones
A frequency method writes the cron expression Laravel matches against the clock. These cover most schedules (the full list also has every-N-hours and quarterly variants):
| Method | Runs | Cron underneath |
|---|---|---|
everyMinute() | Every minute | * * * * * |
everyFiveMinutes() | Every 5 minutes | */5 * * * * |
hourlyAt(17) | 17 minutes past every hour | 17 * * * * |
dailyAt('4:15') | Every day at 04:15 | 15 4 * * * |
twiceDailyAt(1, 13, 15) | 01:15 and 13:15 | 15 1,13 * * * |
weeklyOn(1, '8:00') | Mondays at 08:00 | 0 8 * * 1 |
monthlyOn(4, '15:00') | The 4th of each month, 15:00 | 0 15 4 * * |
lastDayOfMonth('15:00') | The month's last day, 15:00 | Day worked out on each run |
cron('0 7 * * 1-5') | Whatever you write | As written |
everyThirtySeconds() | Twice a minute | * * * * *, split inside Laravel |
Constraints narrow that down, and they come in two kinds. weekdays(), mondays() and days([0, 3]) rewrite the weekday field of the cron. between('8:00', '18:00') and unlessBetween() are filters instead: the task stays due on its normal cadence and Laravel skips it outside the window. Both ends are included, so hourly()->between('8:00', '18:00') runs at 18:00 too. when() and skip() take a closure for anything else, and environments(['production']) checks APP_ENV, which is handy when staging runs the same code but shouldn't email customers.
Times are read in app.timezone, which is UTC unless you changed it in config/app.php. Add 'schedule_timezone' => 'America/Chicago' to the same file to move every task, or chain ->timezone('America/New_York') on one. The docs are blunt about the catch: when daylight saving changes, a zoned task "may run twice or even not run at all," and they recommend avoiding timezone scheduling when you can. If you do use it, keep zoned tasks out of the small hours when clocks change, roughly 01:00 to 03:00 local time, or schedule in UTC and accept that 09:00 local moves by an hour twice a year.
withoutOverlapping: stop a slow run from stacking up
By default Laravel starts a task when it's due, even if the last run is still going. That's fine for a two-second command on an hourly schedule, and a mess for an import that usually takes four minutes, sometimes twelve, on a ten-minute schedule. withoutOverlapping() holds a lock in your cache while the task runs, and a due run that finds the lock taken is skipped.
Schedule::command('feeds:import')
->everyTenMinutes()
->withoutOverlapping(30); // lock expires after 30 minutesWithout an argument the lock expires after 24 hours. That default bites when a server dies mid-run: the lock outlives the process, and the task stays skipped until the lock expires or someone runs php artisan schedule:clear-cache. Pass a ceiling a little above your slowest honest run instead.
Closures need one extra step. Schedule::call() has no command string to build a lock key from, so chaining withoutOverlapping() or onOneServer() throws a LogicException until you call ->name('prune-carts') first. Schedule::job() names the task after the job class for you.
Three servers, three reports: onOneServer
Every server with the crontab line, and every replica with the scheduler switched on, runs schedule:run and reaches the same conclusion about what's due. Three web servers means three reconciles. The Laravel docs use a Friday report generated three times as their example, and their verdict is "Not good!"
onOneServer() is the fix. The first server to reach the task takes an atomic lock in the cache and the others skip it. In the framework source the lock key is the task plus the hour and minute it's due, held for an hour, so each run gets a fresh lock. The docs list two requirements: the app's default cache driver must be database, memcached, dynamodb or redis, and all servers must talk to the same central cache. A file or array cache lives on each machine, so every server wins its own lock and you're back to three runs without any error to tell you.
// app/Providers/AppServiceProvider.php, in boot()
Schedule::alwaysOnOneServer(); // every task but unnamed closures
Schedule::useCache('redis'); // keep the locks in a specific store
// Same job class, different arguments: give each its own name
Schedule::job(new CheckUptime('https://example.com'))
->name('check-uptime:example.com')
->everyFiveMinutes()
->onOneServer();alwaysOnOneServer() skips closures without a name(); those keep running on every server. And onOneServer() doesn't replace withoutOverlapping(). One guards against the same due minute on several machines, the other against a run that's still going when the next one is due. A long nightly job on a cluster wants both.
One slow task delays the rest: runInBackground
Tasks due in the same minute run one after another, in the order you defined them, inside the one schedule:run process. A six-minute reconcile due at 02:00 means the report that was also due at 02:00 starts at 02:06. Flip the toggle to see the difference:
02:00, three tasks due
Everything waits for stripe:reconcile: reports:send was due at 02:00 and starts at 02:06, carts:purge at 02:07.
runInBackground() starts the command as its own process and moves on to the next task. It only works with command() and exec(); on a closure or a Schedule::job() it throws, and a job doesn't need it anyway, since handing work to the queue takes milliseconds. Vapor's docs say to avoid it there, because the Lambda container can shut down before the background task finishes.
Cron can't go below a minute, so Laravel adds everySecond() through everyThirtySeconds(). When you define one, schedule:run stays alive until the end of the minute to fire them. The docs draw two consequences: sub-minute tasks should dispatch jobs or run in the background so a slow one doesn't push the next one back, and your deploy script should call php artisan schedule:interrupt so a schedule:run started before the deploy doesn't keep running old code for the rest of the minute.
Maintenance mode pauses your schedule and your queue
php artisan down stops more than web traffic. The scheduler skips every task that isn't marked evenInMaintenanceMode(), and queue workers stop handling jobs until the app is back up, unless they were started with --force (queues docs). Mark the tasks that must run regardless:
Schedule::command('backups:run')
->dailyAt('3:30')
->evenInMaintenanceMode();Watch the combination: a job dispatched during maintenance waits for a worker, and the workers are paused. Work that has to happen while the site is down should be a command, not a job. Two related switches are worth knowing. php artisan schedule:pause stops every task without a deploy until schedule:continue, except those marked evenWhenPaused(). And on several servers, the default file-based maintenance flag only covers the machine you ran down on; set APP_MAINTENANCE_DRIVER=cache with a store all servers share, as the configuration docs describe.
Output, hooks and knowing it ran
The crontab line sends the scheduler's own output to /dev/null, so give each task somewhere to write. appendOutputTo(storage_path('logs/digest.log')) keeps the command's output, and emailOutputOnFailure('[email protected]') mails it when the command exits non-zero; both work only for command() and exec(). For code, onSuccess() and onFailure() hooks run after the task, and the ScheduledTaskFailed event fires for every failure.
None of those can tell you about a run that never happened: the crontab missing after a server rebuild, maintenance mode left on, a stale lock. A heartbeat can. Laravel's ping hooks call a URL for you:
Schedule::command('reports:send')
->weekdays()
->dailyAt('7:00')
->timezone('America/New_York')
->pingOnSuccess('https://ping.crontap.com/<heartbeat-id>')
->pingOnFailure('https://ping.crontap.com/<heartbeat-id>/fail');pingOnSuccess() fires when the command exits with 0 and pingOnFailure() when it doesn't. Crontap alerts you right away on /fail, and when no success ping arrives within the period plus the grace window, which is the night the crontab quietly disappeared.
The scheduler is a clock; queues do the work
schedule:run and queue:work get mixed up because both make things happen later. They are different processes with different jobs, and most production apps run both.
schedule:run | queue:work | |
|---|---|---|
| Started by | Cron (or your host), every minute | Supervisor, Horizon or your host, once |
| Decides | What's due this minute | Nothing; it takes the next job |
| Lives for | Seconds, or the whole minute with sub-minute tasks | Until --max-time, a restart or a crash |
| Retries | None built in | $tries, backoff and the failed_jobs table |
| After deploy | Runs new code from the next minute | Needs php artisan queue:restart |
The pattern that holds up is to schedule a job, not the work. Schedule::job(new ReconcileStripe) pushes the job onto the queue and returns, so the scheduler never waits on Stripe's API, and the queue gives you retries the scheduler doesn't have:
<?php
namespace App\Jobs;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
class ReconcileStripe implements ShouldQueue, ShouldBeUnique
{
use Queueable;
public $tries = 3;
public $uniqueFor = 3600; // at most one queued copy per hour
public function handle(): void
{
// Fetch yesterday's balance transactions and upsert them by id
}
}ShouldBeUnique refuses to queue a second copy while one is waiting or running, and releases the lock when the job finishes or runs out of attempts. On a VPS, keep the workers alive with Supervisor; this is the docs' configuration with paths adjusted:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/app/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=4
redirect_stderr=true
stdout_logfile=/var/www/app/storage/logs/worker.log
stopwaitsecs=3600--max-time=3600 makes each worker exit after an hour so Supervisor starts a fresh one and any leaked memory goes with it. Add php artisan queue:restart to your deploy so workers pick up new code. On Redis, Horizon runs the same workers with a dashboard, balancing and metrics.
Who runs schedule:run on your host
Most managed Laravel hosts run the scheduler for you, which removes the crontab line but not the decisions above. As of November 2026:
| Host | Who runs the scheduler | Watch out for |
|---|---|---|
| Your own VPS | Your crontab line | PHP binary, php.ini and user (PHP guide) |
| Laravel Forge | The site's "Laravel Scheduler" toggle: every minute, with the site's PHP version | A site on several servers: enable it on one, or chain onOneServer() |
| Laravel Cloud | The "Scheduler" toggle on the App cluster or a worker cluster runs schedule:run every minute | Several replicas: Cloud's docs say to use onOneServer() |
| Laravel Vapor | On by default, with a DynamoDB cache for the locks; scheduler: false turns it off | Avoid runInBackground(); task logs don't reach CloudWatch |
| Docker or Kubernetes | One container running php artisan schedule:work, scaled to exactly one | Cron inside every web container runs every task once per replica |
| Heroku and other PaaS | Heroku Scheduler runs every 10 minutes, hourly or daily | Not every minute, and Heroku says runs are "expected but not guaranteed" |
Sources: Forge, Laravel Cloud, Vapor and Heroku Scheduler.
Two details from those docs are easy to miss. When a Laravel Cloud environment scales to zero, Cloud wakes it for scheduled tasks using the output of schedule:list, captured at deploy time, so a schedule change only takes effect after the next deploy. And Vapor's scheduler isn't guaranteed to start at the top of the minute; for sub-minute tasks its docs suggest scheduler: sub-minute in vapor.yml. For containers, the Docker cron jobs guide covers why one scheduler container beats cron in the image, and on Heroku the Heroku cron jobs page has the setup. Octane doesn't change any of this: it keeps the web app in memory, while schedule:run is still a fresh CLI process each minute.
Run it from outside: a protected route that dispatches a job
Sometimes the clock is better off outside the app. Shared hosting without cron, an environment that scales to zero, a PaaS scheduler that only does every ten minutes. Or you want each schedule in its own timezone, a history of every call, retries and an alert when they run out, and no onOneServer() arithmetic: an HTTP request goes through the load balancer and reaches exactly one server.
The route is small. Run php artisan install:api if the app has no routes/api.php yet; it creates the file (stateless routes, no CSRF check, /api prefix) and installs Sanctum. Then add a middleware that checks a secret header:
<?php
// app/Http/Middleware/VerifyCronSecret.php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class VerifyCronSecret
{
public function handle(Request $request, Closure $next): Response
{
$secret = (string) config('services.cron.secret');
$given = (string) $request->header('X-Cron-Secret');
abort_unless($secret !== '' && hash_equals($secret, $given), 401);
return $next($request);
}
}// routes/api.php
use App\Http\Middleware\VerifyCronSecret;
use App\Jobs\ReconcileStripe;
use Illuminate\Support\Facades\Route;
Route::post('/cron/reconcile', function () {
ReconcileStripe::dispatch();
return response()->json(['queued' => true], 202);
})->middleware(VerifyCronSecret::class);Put the secret in .env as CRON_SECRET and map it in config/services.php ('cron' => ['secret' => env('CRON_SECRET')]), so it survives config:cache. The route dispatches a job instead of calling Artisan::call() because a web request lives inside PHP-FPM and proxy timeouts, often 30 to 60 seconds (the PHP guide lists them), while a queued job gets the worker's time limit, retries and the ShouldBeUnique lock if two calls land close together.
That makes the 202 mean "queued," not "done." The job's failed() method, or a heartbeat ping at the end of handle(), tells you when the work itself fails. And in maintenance mode the route answers 503 like every other one. Usually that's right: the scheduler retries and then alerts you, and the workers are paused anyway. If the route must keep accepting calls, exclude it with $middleware->preventRequestsDuringMaintenance(except: ['api/cron/*']) in bootstrap/app.php.
- 1
Test the route by hand
curl -i -X POST https://app.example.com/api/cron/reconcile \ -H "X-Cron-Secret: $CRON_SECRET"A 202 with
{"queued":true}means the job is on the queue; check the worker log to see it run. A 401 means the header or.envdoesn't match, and a 405 means the request went out as a GET. - 2
Create the schedule
In Crontap, add a
POSTto the URL with theX-Cron-Secretheader, set the cron to15 4 * * *and pickAmerica/New_Yorkfor this schedule. Each schedule keeps its own IANA timezone, whateverapp.timezonesays. - 3
Press Perform test
Perform test calls the route right away and shows the status code, timing and response, so a wrong header shows up now instead of at 04:15.
- 4
Let failures reach you
New schedules retry 5xx responses, timeouts and network errors with exponential backoff and record every attempt. When the attempts run out, Crontap alerts you by email on every plan, or in Slack, Discord or Telegram on paid plans.
The honest trade-offs: this replaces the clock, not the queue, so you still run workers (or your host does). The route has to be reachable over HTTPS. There's no sub-minute cadence; the free Crontap plan covers two schedules or monitors at intervals down to one hour, and paid plans go down to every minute. Many teams mix the two: schedule:run for the housekeeping that lives next to the code, an HTTP schedule for the jobs someone needs to hear about when they fail.
When the scheduler says nothing: a checklist
When a task doesn't run and nothing complains, go down this list in order. Most answers show up in the first three.
- Is the clock running?
crontab -las the user that owns the app, or the scheduler toggle on your host. No line, no schedule. - Does Laravel see the task?
php artisan schedule:listshows it with its next due time. If the time is off by hours, it'sapp.timezone. - Does the task itself work?
php artisan schedule:test --name="reports:send"runs it now and shows the error. - Is the app down or paused? Maintenance mode skips tasks; so does
schedule:pause. - Does a constraint exclude it?
environments()versusAPP_ENV, awhen()closure, abetween()window in another timezone. - Is a lock stuck? A crashed run under
withoutOverlapping()holds its lock for 24 hours by default.php artisan schedule:clear-cache. - Is it a closure? Without
name(),alwaysOnOneServer()ignores it, andwithoutOverlapping()throws. - Several servers on a
filecache? Every server wins its ownonOneServer()lock. Switch the default cache to Redis or the database.
If the crontab line itself is the problem, cron job not running and the cron troubleshooting guide cover the system side, from a stopped cron daemon to permissions and missing environment variables.
FAQ
Laravel scheduler questions
- How do I set up a cron job in Laravel?
- Define the task in routes/console.php with the Schedule facade, for example Schedule::command('reports:send')->dailyAt('2:00'). Then add one crontab line on the server that runs the scheduler every minute: * * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1. Run php artisan schedule:list to check that Laravel sees the task and when it is due next.
- Where do I define scheduled tasks in Laravel 11, 12 and 13?
- In routes/console.php, using Illuminate\Support\Facades\Schedule. If you'd rather keep that file for command definitions, pass a closure to withSchedule() in bootstrap/app.php; it receives the Schedule instance. Apps that started on Laravel 10 or earlier may still schedule in the schedule() method of app/Console/Kernel.php. The chained methods are the same in every location.
- Why is my Laravel scheduled task not running?
- Work down the chain. Is the crontab line installed for the right user, with the full path to PHP and a cd into the project? Does php artisan schedule:list show the task with the next due time you expect? Is the app in maintenance mode, or was the scheduler paused with schedule:pause? Does an environments() constraint exclude this APP_ENV? Is a stale withoutOverlapping lock blocking it (php artisan schedule:clear-cache)? And is the time in app.timezone, UTC by default, rather than your local time?
- What is the difference between schedule:run and schedule:work?
- schedule:run evaluates the schedule once, runs whatever is due, and exits; cron starts it every minute. schedule:work stays in the foreground and invokes the scheduler every minute until you stop it. The Laravel docs suggest schedule:work for local development instead of a crontab entry; in a container it can run as the dedicated scheduler process.
- What is the difference between schedule:run and queue:work?
- schedule:run decides what is due this minute and starts it. queue:work is a long-running worker that takes jobs off the queue and processes them. They work together: a scheduled task calls Schedule::job(new ReconcileStripe), the scheduler pushes it onto the queue in milliseconds, and a worker kept alive by Supervisor, Horizon or your host does the actual work.
- How do I stop a Laravel scheduled task from overlapping?
- Chain withoutOverlapping(). Laravel takes a cache lock while the task runs and skips any due run while the lock is held. The lock expires after 24 hours by default; pass minutes to shorten it, as in withoutOverlapping(10). If a crash leaves a task stuck, php artisan schedule:clear-cache removes the locks. Scheduled closures need a name() before withoutOverlapping().
- How do I run a Laravel scheduled task on only one server?
- Chain onOneServer(). The first server to reach the task takes an atomic lock and the others skip it for that run. It requires the database, memcached, dynamodb or redis cache driver as the app's default cache, and every server must talk to the same central cache. Schedule::alwaysOnOneServer() in AppServiceProvider applies it to every task; closures without a name() still run on every server.
- Which timezone does the Laravel scheduler use?
- The app's timezone, which is UTC unless you changed 'timezone' in config/app.php. Set 'schedule_timezone' in the same file to give every task a different default, or chain ->timezone('America/New_York') on one task. The Laravel docs warn that a daylight saving change can make a zoned task run twice or not at all, and recommend avoiding timezone scheduling when you can.
- Do Laravel scheduled tasks run in maintenance mode?
- No. While php artisan down is active, the scheduler skips every task that isn't marked with evenInMaintenanceMode(). Queue workers stop handling jobs too, unless they were started with --force. Separately, php artisan schedule:pause stops all tasks without a deploy until schedule:continue, except tasks marked evenWhenPaused().
- How do I test a Laravel scheduled task without waiting for it?
- Run php artisan schedule:test. It lists your scheduled tasks and runs the one you pick right away, in the foreground, or the one named with --name. It skips the clock and the when() and between() checks, so it tests the task, not the timing. For the timing, php artisan schedule:list prints each task's cron and next due time, and php artisan schedule:work runs the real scheduler locally.
- Do Forge, Laravel Cloud and Vapor run the scheduler for me?
- Yes, as of November 2026. Forge's Laravel Scheduler toggle creates the every-minute schedule:run job using the site's PHP version. Laravel Cloud's Scheduler toggle runs schedule:run every minute on the App cluster or a worker cluster, and asks you to use onOneServer() when the cluster has several replicas. Vapor configures the scheduler automatically with a DynamoDB cache for its locks, and you turn it off with scheduler: false in vapor.yml.
- Can I run Laravel scheduled tasks without a crontab?
- Yes. Put the work behind a POST route, protect it with a secret header checked with hash_equals(), and have the route dispatch a queued job and answer 202. An external HTTP scheduler such as Crontap calls the route on a cron expression in the timezone you pick. One request reaches one server, so there is nothing to deduplicate, and the job runs on your existing queue workers.
- How do I get alerted when a Laravel scheduled task fails?
- Inside Laravel, chain onFailure() or emailOutputOnFailure(), or listen for the ScheduledTaskFailed event. To catch tasks that never ran at all, chain pingOnSuccess() with a Crontap heartbeat URL and pingOnFailure() with the same URL plus /fail: Crontap alerts you right away on /fail, and when no success ping arrives within the period plus grace. For the HTTP route, Crontap retries 5xx responses, timeouts and network errors, records each attempt, and alerts you by email on every plan, or in Slack, Discord or Telegram on paid plans.
