> ## Documentation Index
> Fetch the complete documentation index at: https://cloud.laravel.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduled Tasks

> Run scheduled tasks for Laravel and Symfony applications on Laravel Cloud without managing cron infrastructure.

## Introduction

Laravel Cloud runs scheduled tasks for Laravel and Symfony applications, so you can run tasks on a defined frequency without managing cron infrastructure yourself. Other supported runtimes can run custom scheduling processes through [Workers](/docs/workers).

**Laravel**

The Laravel framework includes a built-in "cron" system for [task scheduling](https://laravel.com/docs/scheduling) that runs tasks every minute, hour, day, or at another custom frequency. You can enable the scheduler from the Laravel Cloud dashboard.

## Enabling the task scheduler

The most direct way to start running scheduled tasks is to enable the task scheduler on your environment's App cluster. On the App cluster, scheduled tasks run on the same compute instances that handle your application's incoming HTTP traffic.

To get started, click your environment's App cluster in the infrastructure canvas dashboard. Then, enable the "Scheduler" toggle. Finally, save and redeploy the changes to your App cluster.

![](https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?fit=max\&auto=format\&n=MkfTsQSKGENWqY-2\&q=85\&s=bffcd2e33c23831e7ffdd7a8068112d5)

After your deployment completes, Laravel Cloud runs the `schedule:run` Artisan command every minute on your App cluster, and your Laravel application processes its scheduled tasks.

> [!NOTE]
>
> If you would like to run scheduled tasks on infrastructure that is separate from the compute that handles your incoming web traffic, you may also enable the task scheduler on a [worker cluster](/docs/workers#worker-clusters).

## Scheduled tasks and multiple replicas

If you have scaled your environment's compute to use multiple replicas, make sure you are using Laravel's `onOneServer` method when scheduling your tasks. Otherwise, your tasks will run on every replica, which may lead to unexpected behavior in your application. If you intend for a scheduled task to run on all replicas, you may omit the `onOneServer` method when scheduling the task.

For more information on Laravel task scheduling, consult the [Laravel task scheduler documentation](https://laravel.com/docs/scheduling#running-tasks-on-one-server).

## Scheduled tasks and scale-to-zero

When an environment can [scale to zero](/docs/compute#scale-to-zero), it automatically wakes to run your scheduled tasks, so they continue to run on schedule even while the environment is sleeping.

To determine when to wake your application, Laravel Cloud relies on the cron schedules reported by the `php artisan schedule:list` command. Each time you deploy, Laravel Cloud runs this command and stores its output. Laravel Cloud then uses the stored schedule to calculate when each of your tasks is next due, and wakes your environment at that time. Because Laravel Cloud captures this output only at deploy time, changes to your task schedule do not take effect until your next deployment.

When the environment wakes to run a scheduled task, it stays awake for the duration of the sleep timeout. To avoid keeping your environment awake continuously, do not schedule tasks at intervals shorter than your sleep timeout. For example, a task that runs every 5 minutes on an environment with a 5-minute sleep timeout will never allow the environment to sleep.

Laravel Cloud points the scheduler's cache driver at your environment's cache store. The task scheduler queries this store only when a task uses Laravel's `withoutOverlapping` or `onOneServer` methods, or when it runs sub-minute tasks. A typical schedule does not query the store on every run. However, if you frequently run tasks that rely on these methods, the resulting cache lookups may keep an attached database or cache awake, so it cannot scale to zero.

**Symfony**

Symfony's [Scheduler component](https://symfony.com/doc/current/scheduler.html) works with Laravel Cloud's scheduler toggle, so you can run recurring messages on a defined frequency.

## Enabling the task scheduler

To enable the scheduler, click your environment's App cluster in the infrastructure canvas dashboard. Enable the **Scheduler** toggle, then save and redeploy your environment.

![](https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?fit=max\&auto=format\&n=MkfTsQSKGENWqY-2\&q=85\&s=bffcd2e33c23831e7ffdd7a8068112d5)

> [!NOTE]
>
> If you would like to run scheduled tasks on infrastructure that is separate from the compute that handles your incoming web traffic, you may also enable the task scheduler on a [worker cluster](/docs/workers#worker-clusters).

## Cron expressions

If your schedule uses `RecurringMessage::cron(...)`, explicitly require `dragonmantank/cron-expression` in your `composer.json`. The `symfony/scheduler` package lists it only as a `require-dev` dependency, so Composer does not install it for production builds:

```sh theme={null}
composer require dragonmantank/cron-expression
```

Schedules using only `RecurringMessage::every('1 hour')` and similar period-based triggers do not require this package.

## Scheduled tasks and scale-to-zero

Symfony environments can still [scale to zero](/docs/compute#scale-to-zero), but scheduled tasks will not run while the environment is sleeping. To keep scheduled tasks running on time, run the scheduler on a dedicated [worker cluster](/docs/workers#worker-clusters) that does not scale to zero.
