Laravel Scheduler: Fix Cron Jobs and Duplicate Tasks

Diagnose missing cron runs, overlapping tasks, shared cache locks and safe scheduler deployments on Linux.

Quick answer: If the Laravel scheduler is not running, first check the actual cron entry, PHP executable, working directory, application user and schedule definition. If tasks run more than once, distinguish repeated scheduler invocations from overlapping executions and duplicate queue deliveries. Use scheduler locks for coordination, durable operation identifiers for business correctness, and a completion record to verify the intended result.

Laravel scheduler reliability concept showing cron invocation, task locks and verified execution

A scheduled report can fail silently for days while the website remains healthy. A synchronization command can also start twice, consume unnecessary resources and overwrite newer data. For teams building AI-powered publishing systems or SaaS applications, the difference between a missed run and a duplicated run matters as much as the command itself.

This guide uses Laravel 12 and 13 documentation as its framework reference and presents a practical troubleshooting workflow for Linux VPS deployments. Commands and configuration values are illustrative; verify the installed version and your application's behavior before making production changes.

1. Understand the three layers of Laravel scheduling

Trigger: An operating-system cron entry or an explicitly managed scheduler process invokes Laravel. Its job is to wake the application at the appropriate intervals.

Schedule: Laravel evaluates the configured tasks and decides which ones are due. Frequency, time zone, environment, maintenance mode and other conditions can affect that decision.

Execution: A scheduled command performs work directly or dispatches a queued job. The downstream worker, external service and application database determine whether the actual business operation completes.

Do not treat a successful cron invocation as evidence that all three layers are healthy. A cron process might launch Artisan successfully while the desired task is not due. A scheduler might dispatch a report job successfully while no queue worker is processing that queue. Keep separate evidence for the trigger, dispatch and completed result.

2. Diagnose Laravel scheduler not running

Begin with the specific application and the operating-system identity intended to execute it. In a shared hosting environment, the account running PHP-FPM may not be the same account that owns the scheduled task. PHP versions available in an interactive shell can also differ from those available to cron.

From the intended application directory, inspect the installed framework and schedule without triggering due tasks:

pwd
id
php -v
php artisan --version
php artisan schedule:list
crontab -l

These checks are normally observational, but Artisan boots your application, so verify that custom bootstrap code has no unexpected side effects. The crontab command shows the current user's crontab, not every scheduling definition on the server. An administrator may also need to inspect system cron configuration or hosting-panel tasks. Do not expose configuration secrets when sharing diagnostic output.

Look for the intended command and frequency in schedule:list. If the command is missing, check the actual schedule definitions, application version, conditional registration and release directory. Modern Laravel projects commonly define schedules in routes/console.php or through application configuration; older projects may use the console kernel.

If the task appears but never starts, compare the next due time with the host clock and application time zone. Check the scheduler's runtime user, permissions, configuration cache and available PHP extensions. An application can work through its web server and fail through CLI PHP because the two runtimes are configured differently. See Rubic8's PHP and Laravel upgrade compatibility guide for related runtime checks.

3. Configure a single scheduler trigger

On a conventional Linux deployment, a minute-based cron trigger is sufficient for Laravel's standard scheduling model. The framework's task scheduling documentation explains how the scheduler evaluates due tasks and how more frequent tasks are handled.

An illustrative crontab entry under an unprivileged application user might look like this:

* * * * * cd /srv/example-app && /usr/bin/php artisan schedule:run >> /var/log/example-app/scheduler.log 2>&1

Replace the paths with verified deployment paths. Create the log directory with suitable permissions and configure log rotation. This entry runs actual scheduled work: do not add it until you confirm that an equivalent trigger is not already installed. If the hosting control panel manages the same application schedule, avoid adding an independent copy.

Cron uses a limited environment compared with an interactive terminal. Use an absolute PHP path, set the correct working directory and ensure required configuration is available to the intended account. Do not place credentials directly in a crontab command or send full environment dumps to support channels.

For local development, the foreground schedule:work command may be more convenient. A supervised scheduling process can also be a deliberate production choice, but avoid running both a minute-based cron and an independent schedule:work process for the same application unless the topology explicitly requires it. Inspect real completion records instead of assuming that a running process is useful.

4. Why scheduled tasks run twice

There are several different duplication mechanisms. Two cron entries may invoke the same application at the same minute. Two application servers may independently evaluate the same schedule. A slow task may remain active when the next scheduled interval arrives. Finally, a single scheduling invocation can dispatch work that a queue subsequently delivers more than once.

Imagine an inventory synchronization that runs every minute and sometimes takes 90 seconds. Without overlap protection, a new invocation may begin before the previous one finishes. If both runs update the same product records, an older result might overwrite newer information. Even a read-only synchronization can create unnecessary load and exhaust API quotas.

Diagnose the layer responsible using timestamps and operation identifiers. Two scheduler-start records at the same instant suggest duplicate triggers. Consecutive task-start records before the earlier task finishes suggest overlapping execution. One dispatch with multiple worker attempts points toward queue delivery and retry behavior. See the Laravel queue timeout and failed-job guide for the last case.

5. Prevent overlapping scheduler executions

Laravel provides withoutOverlapping to stop a scheduled event from starting while its earlier invocation holds the relevant lock. The lock lifetime is configurable in minutes. Choose a duration based on the task's measured execution and recovery requirements rather than copying a convenient number.

use Illuminate\Support\Facades\Schedule;

// Illustrative command and lock lifetime.
Schedule::command('reports:refresh')
    ->everyFiveMinutes()
    ->withoutOverlapping(20);

Here the 20-minute expiration is an example, not a maximum runtime enforced on the command. If a process continues past expiration, the lock may no longer protect it. Conversely, a terminated process may leave a lock in place until it expires. Use independent execution bounds and record whether the command actually completed.

Do not shorten the lock simply to make a missing task appear to run again. An active lock might be legitimate. Confirm the owning process and inspect the last successful execution before changing coordination state.

Laravel scheduled task recovery concept from checking due time and active locks to verifying the completed operation

6. Coordinate schedules across multiple servers

A different problem occurs when the same schedule is evaluated by multiple application servers. Laravel's onOneServer facility coordinates eligible scheduled events using a shared atomic lock. This is appropriate when a particular occurrence should be initiated by one scheduler node rather than every node.

use Illuminate\Support\Facades\Schedule;

Schedule::command('reports:daily')
    ->dailyAt('08:00')
    ->onOneServer()
    ->withoutOverlapping(30);

This example combines occurrence coordination and overlap protection. The cache store must support the required locking behavior and all participating nodes must use compatible shared cache configuration. A separate local file cache on each host cannot coordinate independent machines. Inspect the store, connection, namespace and task identity on each scheduler node.

Consult the Laravel cache documentation for atomic-lock semantics and the Laravel 12 scheduling reference when maintaining an older application. If you schedule several parameterized variants of a task, give them appropriate distinct identities so unrelated work does not contend for the same lock.

Neither scheduler method guarantees exactly-once external effects. A lock may expire, an application can crash after sending a remote request, and a queue may retry. Protect the business operation separately from the process that initiates it.

7. Dispatch slow work instead of blocking the scheduler

Keep recurring discovery and dispatch lightweight. A scheduler that spends a long time generating reports or contacting external services can delay other due tasks. Separate heavy operations into appropriately supervised queues when that helps isolate workload and improve recovery.

use App\Jobs\RefreshCatalog;
use Illuminate\Support\Facades\Schedule;

Schedule::job(new RefreshCatalog)
    ->everyFiveMinutes()
    ->onOneServer();

The job class is illustrative. This example coordinates the scheduled dispatch; it does not hold a scheduler lock for the full lifetime of the queued work. If a refresh job takes longer than its dispatch interval, implement job-level overlap controls or a durable claim in the application service as appropriate.

Bound queue execution time, configure reservation windows appropriately and check that the correct queue has an active worker. If processing requires a paid AI request, track operation-level cost and avoid repeating a request with an uncertain outcome. Rubic8's asynchronous AI tools guide provides related context for task deadlines and delivery state.

8. Handle stale locks without blindly clearing the cache

A task that unexpectedly stops may leave evidence of a prior run in the scheduler's lock store. Before clearing anything, determine whether the earlier process is still alive, whether a downstream worker is active, and whether the operation has already reached the target system.

A safe incident investigation starts with read-only process and log inspection. Match the actual schedule, deployment path, runtime user and operation identifier. Check other scheduler nodes if the cache is shared. If a job made a remote change, verify the external result independently.

Laravel offers a scheduler-specific command for clearing schedule mutexes when recovery requires it:

php artisan schedule:clear-cache

This command changes coordination state. It is not a diagnostic command and can remove protection for scheduled events. Run it only under a reviewed recovery plan after checking active work and other affected schedules. Do not run a global cache flush as the first response to a suspected stale lock. Shared cache services may contain sessions, application data and locks used by unrelated processes.

For billing, content publishing and notification systems, maintain a persistent operation key and a reconciliation state. If the previous outcome cannot be established, stop the operation for review rather than clearing a lock and treating the next attempt as safe. See Rubic8's webhook idempotency guide for the related data model.

9. Manage time zones, missed runs and deployments

A daily schedule represents a business time, not merely a server clock reading. Prefer an explicit time-zone policy and store durable timestamps consistently. If the business uses a regional time zone with daylight-saving changes, test what happens when a local time repeats or does not exist. A daily date-based operation key can help prevent repeated business effects.

Do not assume the scheduler will automatically reconstruct every missed occurrence after a server outage. If the product requires a daily report even when the server is unavailable at the due minute, build a bounded catch-up process that identifies missing business periods. Backfills should be separately auditable and protected against duplicate operations.

During deployments, check which release directory the scheduler invokes. Sub-minute schedules may continue evaluating using the previous code during the remainder of the active minute. Laravel documents an interrupt command that can be used after deployment for this situation:

php artisan schedule:interrupt

Use this as part of a reviewed deployment procedure for the intended environment, not as a generic cure for missing scheduled tasks. It does not roll back an already completed external action and should not be assumed to terminate every downstream worker or child process. Verify the next invocation and the actual release it uses. Long-running queue workers may require their own graceful restart procedure.

10. Measure the completion of scheduled operations

A meaningful scheduler dashboard distinguishes last trigger, last dispatch, last start, last verified completion and the oldest overdue operation. A healthy trigger with no successful completions is a warning when work is expected. An idle scheduler with no due tasks may be entirely normal.

Record structured events with the schedule identity, intended business period, operation identifier, start and finish timestamps, attempt number and outcome. Use separate states for skipped due to contention, completed, retryable failure and unknown outcome. Redact credentials and unnecessary customer data.

On a small VPS, measure CPU, memory, database load and task duration before increasing frequency. A synchronization command that scans millions of records every minute may be a database design issue rather than a scheduling problem. Review Rubic8's Laravel slow-query optimization guide before adding more concurrency.

11. A production checklist for scheduled tasks

Invocation: Verify one intentional trigger per scheduler deployment, the correct application directory, PHP executable and account. Detect duplicated hosting-panel and system cron entries.

Coordination: Choose overlap protection based on actual runtime and shared-store requirements. Test concurrent starts and expired locks in an isolated environment.

Correctness: Use a unique business operation key, an atomic claim and an independently verified result. Maintain a recovery plan for unknown outcomes.

Delivery: Monitor the scheduler and its queue workers separately. Test a worker crash, missing trigger, missed business period and failed upstream dependency.

Deployment: Confirm that the intended code and cached configuration are active. Keep an operational record of the last successful scheduled run and verify a representative completion after deployment.

Frequently asked questions

Why is my Laravel scheduler not running?

Common causes include a missing or misconfigured cron trigger, an incorrect CLI PHP version, wrong working directory, an unexpected user account, maintenance mode, a task that is not due, or an existing lock. Inspect the schedule and trigger logs before manually executing due tasks.

What is the difference between withoutOverlapping and onOneServer?

Overlap protection coordinates successive executions of a scheduled event; single-server coordination limits which scheduler node initiates an eligible occurrence. In a distributed application, both may be useful. Neither substitutes for idempotent business processing.

Does Laravel need Redis for scheduling?

No. A single-server installation can use a suitable configured cache store, and multi-server coordination can use a compatible shared store such as a database or Redis. Verify the requirements for your framework version and topology.

Is schedule:run safe to use for troubleshooting?

It can execute tasks that are due, so it is not a read-only inspection command. Start with schedule:list, logs and process inspection. Use a controlled staging environment or explicitly authorized production execution when testing actual work.

Will clearing scheduler locks fix a stuck task?

It can remove a stale coordination lock, but it does not prove that the previous operation stopped or failed. Check running processes and external results first. Clearing an active lock may allow another invocation to begin.

Does scheduling a queued job prevent duplicate queue attempts?

No. Dispatch coordination and queue execution are different stages. Configure worker timeout and retry behavior, then enforce operation-level idempotency and verification.

Final thoughts

Reliable scheduling is not simply a cron line that runs every minute. It is an observable chain from an intended business period to a verified outcome. Start with a simple trigger, make concurrency boundaries explicit, and build recovery around durable evidence. Add more infrastructure only when measurements justify it.

Editorial note: Reviewed November 28, 2026. The linked Laravel 12 and 13 scheduling and cache references are the framework sources. Example commands, timings, architecture and troubleshooting procedures are Rubic8 editorial guidance, not production benchmark results. Adapt them to the application's actual runtime and test changes before deploying.


Rubic8 Editorial Team

Editorial Team

Rubic8 creates practical guides and free tools for developers, webmasters, and digital publishers. Our fast-changing technical content is reviewed against current primary documentation before publication.

We care about your data and would love to use cookies to improve your experience.