Run recurring commands on a schedule, or run your framework’s task scheduler, on Laravel Cloud.
Introduction
Laravel Cloud runs scheduled tasks without requiring you to manage cron infrastructure. Laravel Rust, Laravel PHP, and Symfony applications run their framework’s task scheduler. For every other application, you define scheduled tasks and their schedules in the dashboard.
Laravel Rust
Laravel PHP
Symfony
Other stacks
Laravel Rust includes a task scheduler that runs your application’s scheduled tasks. To enable it, click your environment’s App cluster or a worker cluster in the infrastructure canvas dashboard, enable the Scheduler toggle, then save and redeploy. Laravel Cloud runs your binary’s schedule:work command, which runs your due tasks every minute.
Scheduled tasks and scale to zero
When an environment can scale to zero, it automatically wakes to run your scheduled tasks, so they continue to run on schedule even while the environment is sleeping.See the Laravel Rust deploy guide to learn more.
The Laravel framework includes a built-in “cron” system for task 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.
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.
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.
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.
Scheduled tasks and scale to zero
When an environment can 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’s Scheduler component 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.
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.
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:
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, 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 that does not scale to zero.
If your framework doesn’t have a scheduler that Laravel Cloud runs for you, define each command and its schedule in the dashboard, and Cloud runs it on the selected compute cluster. You don’t need to install cron or run a scheduling process inside your application.
Configure scheduled commands
To add a scheduled command:
Open your environment’s App cluster or a worker cluster on the infrastructure canvas.
In Scheduled commands, click New command.
Enter the command and choose a schedule.
Click Create, then save the cluster settings and deploy the environment.
For example, if your repository contains an executable cleanup script at scripts/cleanup.sh, use:
./scripts/cleanup.sh
Commands can read your environment’s variables, including your database credentials. You may chain commands with shell operators such as &&:
To change a command or its schedule, edit it in Scheduled commands and save the cluster settings. The change takes effect after your next deployment.
Schedules
Scheduled tasks have the following presets:
Preset
When it runs
Every hour
At a fixed minute past each hour
Every day
At a fixed time between 12:00 AM and 12:15 AM UTC
Every week
On Sunday, at a fixed time shortly after midnight UTC
Every month
On the 1st of the month, at a fixed time shortly after midnight UTC
When you create a command with a preset, Cloud picks a random offset from the top of the hour or from midnight. The command uses the same offset for every run. To see the exact time, save the command and hover over its next run time.To run a command at an exact time, select Custom and enter a cron expression or an alias such as @hourly, @daily, @weekly, @monthly, or @yearly. For example, 30 2 * * 1-5 runs at 2:30 AM UTC every weekday. As you type, Cloud describes the expression in plain language. Cloud rejects invalid expressions. All schedules use UTC.
Scheduled commands and multiple replicas
Each scheduled command runs on one instance of its cluster, no matter how many replicas the cluster has.
Timeouts and interruptions
Each run of a scheduled command may take up to 30 minutes. Cloud stops any run that is still going after 30 minutes.Cloud cannot guarantee that every run will finish, even within the 30-minute limit. Deployments, scaling, and platform maintenance replace the instances that run your commands. When an instance stops, Cloud sends a SIGTERM signal to its processes and waits for your environment’s graceful shutdown timeout (30 seconds by default). Then Cloud stops any process that is still running.For this reason, write scheduled commands so they can safely run again after an interruption. If a task takes longer than a few minutes, consider breaking it into smaller pieces of work and processing them in a background worker.
Scheduled commands and scale to zero
Laravel Cloud wakes a sleeping App cluster to run its scheduled commands, so you can keep scale to zero enabled. You don’t need to run a separate cron process in your application or configure a manual wake interval for these commands.If your command enqueues work instead of completing it directly, configure a worker to process that queue. A worker cluster that stays awake can process queued work independently of the App cluster.
View command output
Cloud sends the output of each run to your environment’s Logs dashboard. To view a command’s runs, open its … menu and select View logs. On the Logs page, you may filter to a single scheduled command or to every scheduled command on an instance.Each log entry includes the command’s output, its exit code, and when it started and finished. Cloud highlights runs that exit with a non-zero code.
Failed command alerts
When a scheduled command exits with a non-zero code, Cloud notifies you by email or Slack, based on your notification settings. Each alert links directly to that command’s logs.Cloud sends at most one failure alert per scheduled command every 24 hours. For example, a command that runs every minute and fails every time produces one alert in 24 hours, not one per run. A successful run resets the limit, so Cloud alerts you right away the next time the command fails.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Laravel Cloud","colors":{"primary":"#0057FF","light":"#71A8FF","dark":"#0057FF"},"logo":{"light":"https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/logo/laravel-logo-light.png?fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=f508d8e9c4e3c842e83d055cc376daa1","dark":"https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/logo/laravel-logo-dark.png?fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=fcfe00a4914f5e3ad791b606c3e75795","href":"https://cloud.laravel.com/"},"favicon":{"light":"https://mintcdn.com/cloud/QoefkFOgGxD9GpPV/favicons/favicon-light.svg?fit=max\u0026auto=format\u0026n=QoefkFOgGxD9GpPV\u0026q=85\u0026s=7895f95b1f94018d72bf1d79402bd1e5","dark":"https://mintcdn.com/cloud/QoefkFOgGxD9GpPV/favicons/favicon-dark.svg?fit=max\u0026auto=format\u0026n=QoefkFOgGxD9GpPV\u0026q=85\u0026s=89927b20746f9a0574fa312e44fef351"},"background":{"color":{"light":"#ffffff","dark":"#111110"}},"navbar":{"links":[],"primary":{"type":"button","label":"Get started","href":"https://cloud.laravel.com"}},"footer":{"socials":{"x":"https://x.com/laravel","github":"https://github.com/laravel","youtube":"https://www.youtube.com/laravelphp"}},"seo":{"metatags":{"robots":"noindex"}},"styling":{"codeblocks":{"theme":{"light":"min-light","dark":"material-theme-palenight"}},"latex":true},"integrations":{"fathom":{"siteId":"KZRWMQWT"}},"banner":{"content":"Deploy Laravel PHP, Rails, Django, FastAPI, Express, NestJS, Go, Rust, and more on Laravel Cloud. \u003ca href='https://laravel.com/cloud/docs/runtimes'>Learn more →\u003c/a>","dismissible":true},"contextual":{"options":["copy","chatgpt","claude","cursor","vscode"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cloud","hasAudioNarration":false,"actualSubdomain":"cloud","customDomains":["cloud.laravel.com"],"gitSource":{"type":"github","owner":"laravel","repo":"cloud-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b0f14a7b7fb227b85e39f2c","clientVersion":"0.0.4389","searchFilterCounts":[{"language":"default","tag":"API","count":180},{"language":"default","tag":"Endpoints","count":167},{"language":"default","tag":"Documentation","count":75},{"language":"default","tag":"Environments","count":25},{"language":"default","tag":"Knowledge Base","count":21},{"language":"default","tag":"Basics","count":19},{"language":"default","tag":"Instances","count":14},{"language":"default","tag":"Observability","count":13},{"language":"default","tag":"Caches","count":11},{"language":"default","tag":"Database Clusters","count":10}]},"assistantConfig":{"enableAskAiButton":true,"enableAskAiSearchBar":false,"deflection":{"enabled":false,"showHelpButton":false}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"styles.css","content":"@font-face{font-family:\"Timeless Sans\";src:url(\"/fonts/TimelessSans-Regular.woff2\") format(\"woff2\");font-weight:420;font-style:normal;font-display:swap}@font-face{font-family:\"Timeless Sans\";src:url(\"/fonts/TimelessSans-RegularItalic.woff2\") format(\"woff2\");font-weight:420;font-style:italic;font-display:swap}@font-face{font-family:\"Timeless Sans\";src:url(\"/fonts/TimelessSans-Medium.woff2\") format(\"woff2\");font-weight:500;font-style:normal;font-display:swap}@font-face{font-family:\"Timeless Sans\";src:url(\"/fonts/TimelessSans-MediumItalic.woff2\") format(\"woff2\");font-weight:500;font-style:italic;font-display:swap}@font-face{font-family:\"Timeless Sans\";src:url(\"/fonts/TimelessSans-Semibold.woff2\") format(\"woff2\");font-weight:600;font-style:normal;font-display:swap}@font-face{font-family:\"IBM Plex Mono\";src:url(\"/fonts/IBMPlexMono-Var-Roman.woff2\") format(\"woff2\");font-weight:100 700;font-style:normal;font-display:swap}@font-face{font-family:\"IBM Plex Mono\";src:url(\"/fonts/IBMPlexMono-Var-Italic.woff2\") format(\"woff2\");font-weight:100 700;font-style:italic;font-display:swap}:root{--font-sans: \"Timeless Sans\", ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--font-mono: \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--tracking-tight: -0.025em;--sand-1: #ffffff;--sand-2: #f9f9f8;--sand-3: #f1f0ef;--sand-4: #e9e8e6;--sand-5: #e2e1de;--sand-6: #dad9d6;--sand-9: #8d8d86;--sand-11: #63635e;--sand-12: #21201c;--gray-50: 249 249 248 !important;--gray-100: 241 240 239 !important;--gray-200: 226 225 222 !important;--gray-300: 207 206 202 !important;--gray-400: 141 141 134 !important;--gray-500: 111 109 102 !important;--gray-600: 99 99 94 !important;--gray-700: 73 72 68 !important;--gray-800: 42 42 40 !important;--gray-900: 25 25 24 !important;--gray-950: 17 17 16 !important;--background-light: 255 255 255 !important;--background-dark: 17 17 16 !important}.dark{--sand-1: #111110;--sand-2: #191918;--sand-3: #222221;--sand-4: #2a2a28;--sand-5: #31312e;--sand-6: #3b3a37;--sand-9: #6f6d66;--sand-11: #b5b3ad;--sand-12: #eeeeec}html,body{font-family:var(--font-sans);font-weight:420}body,body *{letter-spacing:calc(\n var(--tracking-tight) + clamp(calc(-0.04em - var(--tracking-tight)), (23.5px - 1em) * 1000, 0px) +\n clamp(0px, (13.5px - 1em) * 1000, calc(0px - var(--tracking-tight)))\n )}code,pre,kbd,samp,code *,pre *,kbd *,samp *{font-family:var(--font-mono)!important;font-feature-settings:\"ss01\" 1, \"ss02\" 1, \"ss03\" 1;letter-spacing:normal!important}b,strong,.font-semibold,.font-bold{font-weight:500!important}#page-title,#content :is(h1,h2,h3,h4){font-family:var(--font-sans)!important;font-weight:500!important;color:var(--sand-12)}#page-title{font-size:2rem;line-height:1.15;text-wrap:balance}@media (min-width: 1024px){#page-title{font-size:2.5rem;line-height:1.1}}#content{font-size:1rem;line-height:1.75rem;color:var(--sand-11)}#content strong{color:var(--sand-12)}#content>h2{margin-top:3.5rem;margin-bottom:1.25rem;padding-top:2.5rem;border-top:1px solid var(--sand-6);font-size:1.5rem;line-height:2rem}#content>h2:first-child{margin-top:0;padding-top:0;border-top:0}#content>h3{margin-top:2.5rem;margin-bottom:0.75rem;font-size:1.125rem;line-height:1.75rem}#content>h4{margin-top:2rem;margin-bottom:0.5rem;font-size:1rem;line-height:1.75rem}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){--link-ink: var(--sand-12);color:inherit!important;font-weight:inherit!important;border-bottom:0!important;text-decoration-line:underline;text-decoration-color:color-mix(in srgb, currentcolor 40%, transparent);text-decoration-thickness:1px;text-underline-offset:0.2em;text-decoration-skip-ink:auto;transition:color 100ms ease-out, text-decoration-color 100ms ease-out}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)):is(:hover,:focus-visible){color:color-mix(in oklab, currentcolor, var(--link-ink) 50%)!important;text-decoration-color:currentcolor}.prose :not(pre)>code{padding:1px 0.25rem;border:0!important;border-radius:0!important;background-color:var(--sand-3)!important;color:var(--sand-12);font-size:0.875em;font-weight:400;box-decoration-break:clone;-webkit-box-decoration-break:clone;overflow-wrap:break-word}.prose :not(pre)>code::before,.prose :not(pre)>code::after{content:none}#content :is(h1,h2,h3,h4) code{font-size:0.875em}.code-block,.code-group,.code-block .code-block-background{border-radius:0!important}.code-group{--rounded-xl: 0px}.code-block,.code-group{border-color:var(--sand-6)!important;box-shadow:none!important}.dark :is(.code-block,.code-group) .code-block-background,.dark :is(.code-block,.code-group) pre.shiki{background-color:var(--sand-2)!important}.code-block-fade-overlay{--fade-color-dark: var(--sand-2) !important;border-radius:0!important}.code-block pre code,.code-block pre code *{font-size:13px!important;line-height:2!important}#content table{font-size:0.875rem;line-height:1.5rem}#content table thead{border-bottom:1px solid var(--sand-6)}#content table th{font-family:var(--font-mono);font-feature-settings:\"ss01\" 1, \"ss02\" 1, \"ss03\" 1;font-size:11px;line-height:normal;font-weight:400!important;letter-spacing:0.06em!important;text-transform:uppercase;color:var(--sand-9);vertical-align:bottom}#content table tbody tr{border-color:var(--sand-5)}@media (min-width: 1024px){:root{--sidebar-width: 16.5rem}.max-w-8xl{max-width:100rem!important}}@media (min-width: 1280px){#content-container:has(#table-of-contents-layout) #content-area{width:calc(100% - 16.5rem)!important}#table-of-contents-layout{width:16.5rem!important}#content-area>*{max-width:48rem}}.callout{gap:1rem!important;padding:1rem!important;border-radius:0!important;border:1px solid var(--sand-6)!important;background-color:var(--sand-2)!important;--callout-accent: #0057ff}@media (min-width: 1024px){.callout{padding:1.25rem!important}}.callout[data-callout-type=\"tip\"]{--callout-accent: #8d54c5}.callout:is([data-callout-type=\"warning\"],[data-callout-type=\"danger\"]){--callout-accent: #f53003}.callout[data-callout-type=\"check\"]{--callout-accent: #18b69b}.callout [data-component-part=\"callout-icon\"]{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:2rem!important;height:2rem;margin:0!important;border-radius:2px;background-color:var(--callout-accent)}.callout [data-component-part=\"callout-icon\"] svg{width:1rem!important;height:1rem!important;color:#ffffff!important}.callout [data-component-part=\"callout-icon\"] svg[style*=\"mask-image\"]{background-color:#ffffff!important}.callout [data-component-part=\"callout-content\"]{padding-top:0.125rem;font-size:1rem!important;line-height:1.75rem!important;color:var(--sand-11)!important}.callout [data-component-part=\"callout-content\"] strong{color:var(--sand-12)!important}.card,.accordion,.accordion-group,.accordion summary,.code-group,.code-block [data-component-part=\"code-block-header\"]{border-radius:0!important}.card,.accordion-group,.accordion{border-color:var(--sand-6)!important;box-shadow:none!important}.card{background-color:var(--sand-1)!important}.card:hover{border-color:var(--sand-9)!important}.frame{padding:0!important;background:transparent!important}.frame>.absolute{display:none}.code-block:has([data-component-part=\"code-block-header\"]){padding:0!important;background-color:var(--sand-2)!important}.code-block [data-component-part=\"code-block-header\"]{border-bottom:1px solid var(--sand-6)}.code-block:has([data-component-part=\"code-block-header\"]) .code-block-background{background-color:var(--sand-1)!important}.dark .code-block:has([data-component-part=\"code-block-header\"]) .code-block-background{background-color:var(--sand-2)!important}[data-component-part=\"tabs-list\"]{border-color:var(--sand-6)!important}[data-component-part=\"tab-button\"]{font-weight:500!important;color:var(--sand-11)!important}[data-component-part=\"tab-button\"][data-active=\"true\"]{color:var(--sand-12)!important;border-color:var(--sand-12)!important}[data-component-part=\"step-number\"]>div{border-radius:2px!important;background-color:var(--sand-3)!important;color:var(--sand-12)!important;font-weight:500!important}[data-component-part=\"step-line\"]{background-color:var(--sand-6)!important}.sidebar-group-header{font-weight:500!important;color:var(--sand-12)!important}.sidebar-group{margin-left:1rem;border-left:1px solid var(--sand-6)}.sidebar-group .sidebar-group{margin-left:0;border-left:0}#navigation-items li>a{margin-left:-1px;padding-top:0.25rem!important;padding-bottom:0.25rem!important;line-height:1.25rem;padding-left:0.875rem!important;border-left:1px solid transparent;border-radius:0!important;background-color:transparent!important;color:var(--sand-11)!important;text-shadow:none!important}#navigation-items li>a:hover{border-left-color:var(--sand-9);color:var(--sand-12)!important}#navigation-items li[data-active=\"true\"]>a{border-left-color:rgb(var(--primary));color:rgb(var(--primary))!important}.dark #navigation-items li[data-active=\"true\"]>a{border-left-color:rgb(var(--primary-light));color:rgb(var(--primary-light))!important}#table-of-contents h2 button{font-family:var(--font-mono);font-feature-settings:\"ss01\" 1, \"ss02\" 1, \"ss03\" 1;font-size:11px;font-weight:400!important;letter-spacing:0.06em!important;text-transform:uppercase;color:var(--sand-9)!important}#table-of-contents h2 button svg{display:none}#table-of-contents-content{border-left:1px solid var(--sand-6)}#table-of-contents-content .toc-item>a{margin-left:-1px;padding-left:0.875rem;border-left:1px solid transparent;font-size:13px;line-height:1.25rem;font-weight:420!important;color:var(--sand-11)!important}#table-of-contents-content .toc-item[data-depth=\"1\"]>a{padding-left:1.5rem!important}#table-of-contents-content .toc-item>a:hover{border-left-color:var(--sand-9);color:var(--sand-12)!important}#table-of-contents-content .toc-item>a[aria-current=\"location\"]{border-left-color:rgb(var(--primary));color:var(--sand-12)!important}#navbar-transition{border-color:var(--sand-6)!important}#footer{border-color:var(--sand-6)!important}.table-auto{table-layout:auto}table.table-fixed{table-layout:fixed!important}table{table-layout:auto!important;display:table}th{text-align:left}td>p.icon{margin:0}.short{p {\n margin-top: 0;\n margin-bottom: 0;\n }}.pr-16{padding-right:4em}.max-w-none{max-width:none!important}.align-top{vertical-align:top}.italic{font-style:italic}.pr-20{padding-right:5rem}.max-h-50vh{max-height:50vh}.select-arrow{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-size:1.5em 1.5em;background-position:right 0.5rem center;background-repeat:no-repeat}#banner a{color:rgb(var(--white))!important;white-space:nowrap}#banner>div>p{white-space:normal;padding-top:0.125rem;padding-bottom:0.125rem;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;line-clamp:3;-webkit-line-clamp:3}#banner:has(>button){padding-right:2.5rem}@media screen and (min-width: 768px){#banner{height:auto}#banner:has(>button){padding-left:2.5rem}}#topbar-cta-button a{height:2rem;padding:0 0.75rem!important}#topbar-cta-button a>span:first-child{border-radius:0!important;background-color:var(--sand-12);opacity:1!important;transition:background-color 100ms ease-out}#topbar-cta-button a:hover>span:first-child{background-color:var(--sand-11)}.dark #topbar-cta-button a:hover>span:first-child{background-color:#ffffff}#topbar-cta-button a .z-10,#topbar-cta-button a .z-10 span,#topbar-cta-button a svg{color:var(--sand-1)!important}#page-context-menu>button{height:2rem;border-radius:0!important;border-color:var(--sand-6)!important;background-color:var(--sand-1)!important;color:var(--sand-12)!important}#page-context-menu>button:hover{background-color:var(--sand-2)!important}[id^=\"search-bar-entry\"]{border-radius:0!important;--tw-ring-color: var(--sand-6) !important;filter:none!important}[id^=\"search-bar-entry\"]:hover{--tw-ring-color: var(--sand-9) !important}.callout [data-component-part=\"callout-icon\"]:empty{display:none}.method-pill,.tryit-button,:has(>*>.tryit-button),:has(>.method-pill),.method-nav-pill>span,.nav-tag-pill-text,[data-component-part=\"field-info-pill\"],[data-component-part=\"field-required-pill\"],:has(>.method-pill) .rounded-md{border-radius:0!important}"}]}
{"page":{"pagePath":"scheduled-tasks","slug":"/scheduled-tasks","pageMetadata":{"title":"Scheduled tasks","sidebarTitle":"Scheduled tasks","description":"Run recurring commands on a schedule, or run your framework's task scheduler, on Laravel Cloud.","href":"/scheduled-tasks"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Run recurring commands on a schedule, or run your framework’s task scheduler, on Laravel Cloud.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Frame,Heading,Info,OptimizedImage,Tab,Table,Tabs}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`introduction`,children:`Introduction`}),`\n`,_jsxs(_components.p,{children:[`Laravel Cloud runs scheduled tasks without requiring you to manage cron infrastructure. Laravel Rust, Laravel PHP, and Symfony applications run their framework’s task scheduler. For every other application, you define `,_jsx(_components.a,{href:`#other-stacks`,children:`scheduled tasks`}),` and their schedules in the dashboard.`]}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`Laravel Rust`,id:`laravel-rust`,\"data-child-heading-ids\":`[\"scheduled-tasks-and-scale-to-zero\"]`,children:[_jsxs(_components.p,{children:[`Laravel Rust includes a task scheduler that runs your application’s scheduled tasks. To enable it, click your environment’s App cluster or a `,_jsx(_components.a,{href:`/workers#worker-clusters`,children:`worker cluster`}),` in the infrastructure canvas dashboard, enable the `,_jsx(_components.strong,{children:`Scheduler`}),` toggle, then save and redeploy. Laravel Cloud runs your binary’s `,_jsx(_components.code,{children:`schedule:work`}),` command, which runs your due tasks every minute.`]}),_jsx(Heading,{level:`2`,id:`scheduled-tasks-and-scale-to-zero`,children:`Scheduled tasks and scale to zero`}),_jsxs(_components.p,{children:[`When an environment can `,_jsx(_components.a,{href:`/compute#scale-to-zero`,children:`scale to zero`}),`, it automatically wakes to run your scheduled tasks, so they continue to run on schedule even while the environment is sleeping.`]}),_jsxs(_components.p,{children:[`See the `,_jsx(_components.a,{href:`/deploy-guides/laravel-rust#task-scheduling`,children:`Laravel Rust deploy guide`}),` to learn more.`]})]}),_jsxs(Tab,{title:`Laravel PHP`,id:`laravel-php`,\"data-child-heading-ids\":`[\"enabling-the-task-scheduler\",\"scheduled-tasks-and-multiple-replicas\",\"scheduled-tasks-and-scale-to-zero-2\"]`,children:[_jsxs(_components.p,{children:[`The Laravel framework includes a built-in “cron” system for `,_jsx(_components.a,{href:`https://laravel.com/docs/scheduling`,children:`task scheduling`}),` that runs tasks every minute, hour, day, or at another custom frequency. You can enable the scheduler from the Laravel Cloud dashboard.`]}),_jsx(Heading,{level:`2`,id:`enabling-the-task-scheduler`,children:`Enabling the task scheduler`}),_jsx(_components.p,{children:`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.`}),_jsx(_components.p,{children:`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.`}),_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=bffcd2e33c23831e7ffdd7a8068112d5`,\"data-og-width\":`1024`,width:`1024`,\"data-og-height\":`222`,height:`222`,\"data-path\":`images/scheduler.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=280\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=49eb69f168b5a30b470e664a0b9da6f5 280w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=560\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=ff6bbddd8622b4b59eec536ec5d58e79 560w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=840\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=38725b57c927f176fe883a1591bf81bb 840w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=18a55189d03c643390643a28dbee43d0 1100w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=9011ef944dd38744fbd3dbbc55d9aa6f 1650w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=cbfebb21657ece6544e3316ecf1e193f 2500w`})}),_jsxs(_components.p,{children:[`After your deployment completes, Laravel Cloud runs the `,_jsx(_components.code,{children:`schedule:run`}),` Artisan command every minute on your App cluster, and your Laravel application processes its scheduled tasks.`]}),_jsx(Info,{children:_jsxs(_components.p,{children:[`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 `,_jsx(_components.a,{href:`/workers#worker-clusters`,children:`worker cluster`}),`.`]})}),_jsx(Heading,{level:`2`,id:`scheduled-tasks-and-multiple-replicas`,children:`Scheduled tasks and multiple replicas`}),_jsxs(_components.p,{children:[`If you have scaled your environment’s compute to use multiple replicas, make sure you are using Laravel’s `,_jsx(_components.code,{children:`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 `,_jsx(_components.code,{children:`onOneServer`}),` method when scheduling the task.`]}),_jsxs(_components.p,{children:[`For more information on Laravel task scheduling, consult the `,_jsx(_components.a,{href:`https://laravel.com/docs/scheduling#running-tasks-on-one-server`,children:`Laravel task scheduler documentation`}),`.`]}),_jsx(Heading,{level:`2`,id:`scheduled-tasks-and-scale-to-zero-2`,children:`Scheduled tasks and scale to zero`}),_jsxs(_components.p,{children:[`When an environment can `,_jsx(_components.a,{href:`/compute#scale-to-zero`,children:`scale to zero`}),`, it automatically wakes to run your scheduled tasks, so they continue to run on schedule even while the environment is sleeping.`]}),_jsxs(_components.p,{children:[`To determine when to wake your application, Laravel Cloud relies on the cron schedules reported by the `,_jsx(_components.code,{children:`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.`]}),_jsx(_components.p,{children:`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.`}),_jsxs(_components.p,{children:[`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 `,_jsx(_components.code,{children:`withoutOverlapping`}),` or `,_jsx(_components.code,{children:`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.`]})]}),_jsxs(Tab,{title:`Symfony`,id:`symfony`,\"data-child-heading-ids\":`[\"enabling-the-task-scheduler-2\",\"cron-expressions\",\"scheduled-tasks-and-scale-to-zero-3\"]`,children:[_jsxs(_components.p,{children:[`Symfony’s `,_jsx(_components.a,{href:`https://symfony.com/doc/current/scheduler.html`,children:`Scheduler component`}),` works with Laravel Cloud’s scheduler toggle, so you can run recurring messages on a defined frequency.`]}),_jsx(Heading,{level:`2`,id:`enabling-the-task-scheduler-2`,children:`Enabling the task scheduler`}),_jsxs(_components.p,{children:[`To enable the scheduler, click your environment’s App cluster in the infrastructure canvas dashboard. Enable the `,_jsx(_components.strong,{children:`Scheduler`}),` toggle, then save and redeploy your environment.`]}),_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=bffcd2e33c23831e7ffdd7a8068112d5`,\"data-og-width\":`1024`,width:`1024`,\"data-og-height\":`222`,height:`222`,\"data-path\":`images/scheduler.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=280\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=49eb69f168b5a30b470e664a0b9da6f5 280w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=560\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=ff6bbddd8622b4b59eec536ec5d58e79 560w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=840\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=38725b57c927f176fe883a1591bf81bb 840w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=18a55189d03c643390643a28dbee43d0 1100w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=9011ef944dd38744fbd3dbbc55d9aa6f 1650w, https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/images/scheduler.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=cbfebb21657ece6544e3316ecf1e193f 2500w`})}),_jsx(Info,{children:_jsxs(_components.p,{children:[`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 `,_jsx(_components.a,{href:`/workers#worker-clusters`,children:`worker cluster`}),`.`]})}),_jsx(Heading,{level:`2`,id:`cron-expressions`,children:`Cron expressions`}),_jsxs(_components.p,{children:[`If your schedule uses `,_jsx(_components.code,{children:`RecurringMessage::cron(...)`}),`, explicitly require `,_jsx(_components.code,{children:`dragonmantank/cron-expression`}),` in your `,_jsx(_components.code,{children:`composer.json`}),`. The `,_jsx(_components.code,{children:`symfony/scheduler`}),` package lists it only as a `,_jsx(_components.code,{children:`require-dev`}),` dependency, so Composer does not install it for production builds:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes min-light material-theme-palenight`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#292D3E`,color:`#24292eff`,\"--shiki-dark\":`#babed8`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#FFCB6B`},children:`composer`}),_jsx(_components.span,{style:{color:`#2B5581`,\"--shiki-dark\":`#C3E88D`},children:` require`}),_jsx(_components.span,{style:{color:`#2B5581`,\"--shiki-dark\":`#C3E88D`},children:` dragonmantank/cron-expression`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`Schedules using only `,_jsx(_components.code,{children:`RecurringMessage::every('1 hour')`}),` and similar period-based triggers do not require this package.`]}),_jsx(Heading,{level:`2`,id:`scheduled-tasks-and-scale-to-zero-3`,children:`Scheduled tasks and scale to zero`}),_jsxs(_components.p,{children:[`Symfony environments can still `,_jsx(_components.a,{href:`/compute#scale-to-zero`,children:`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 `,_jsx(_components.a,{href:`/workers#worker-clusters`,children:`worker cluster`}),` that does not scale to zero.`]})]}),_jsxs(Tab,{title:`Other stacks`,id:`other-stacks`,\"data-child-heading-ids\":`[\"configure-scheduled-commands\",\"schedules\",\"scheduled-commands-and-multiple-replicas\",\"timeouts-and-interruptions\",\"scheduled-commands-and-scale-to-zero\",\"view-command-output\",\"failed-command-alerts\"]`,children:[_jsx(_components.p,{children:`If your framework doesn’t have a scheduler that Laravel Cloud runs for you, define each command and its schedule in the dashboard, and Cloud runs it on the selected compute cluster. You don’t need to install cron or run a scheduling process inside your application.`}),_jsx(Heading,{level:`2`,id:`configure-scheduled-commands`,children:`Configure scheduled commands`}),_jsx(_components.p,{children:`To add a scheduled command:`}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Open your environment’s App cluster or a `,_jsx(_components.a,{href:`/workers#worker-clusters`,children:`worker cluster`}),` on the infrastructure canvas.`]}),`\n`,_jsxs(_components.li,{children:[`In `,_jsx(_components.strong,{children:`Scheduled commands`}),`, click `,_jsx(_components.strong,{children:`New command`}),`.`]}),`\n`,_jsx(_components.li,{children:`Enter the command and choose a schedule.`}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Create`}),`, then save the cluster settings and deploy the environment.`]}),`\n`]}),_jsxs(_components.p,{children:[`For example, if your repository contains an executable cleanup script at `,_jsx(_components.code,{children:`scripts/cleanup.sh`}),`, use:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes min-light material-theme-palenight`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#292D3E`,color:`#24292eff`,\"--shiki-dark\":`#babed8`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#FFCB6B`},children:`./scripts/cleanup.sh`})}),`\n`]})})}),_jsxs(_components.p,{children:[`Commands can read your environment’s variables, including your database credentials. You may chain commands with shell operators such as `,_jsx(_components.code,{children:`\u0026\u0026`}),`:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes min-light material-theme-palenight`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#292D3E`,color:`#24292eff`,\"--shiki-dark\":`#babed8`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#FFCB6B`},children:`python`}),_jsx(_components.span,{style:{color:`#2B5581`,\"--shiki-dark\":`#C3E88D`},children:` manage.py`}),_jsx(_components.span,{style:{color:`#2B5581`,\"--shiki-dark\":`#C3E88D`},children:` clearsessions`}),_jsx(_components.span,{style:{color:`#212121`,\"--shiki-dark\":`#89DDFF`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#FFCB6B`},children:` python`}),_jsx(_components.span,{style:{color:`#2B5581`,\"--shiki-dark\":`#C3E88D`},children:` manage.py`}),_jsx(_components.span,{style:{color:`#2B5581`,\"--shiki-dark\":`#C3E88D`},children:` cleanup_uploads`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`To change a command or its schedule, edit it in `,_jsx(_components.strong,{children:`Scheduled commands`}),` and save the cluster settings. The change takes effect after your next deployment.`]}),_jsx(Heading,{level:`2`,id:`schedules`,children:`Schedules`}),_jsx(_components.p,{children:`Scheduled tasks have the following presets:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Preset`}),_jsx(_components.th,{children:`When it runs`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Every hour`})}),_jsx(_components.td,{children:`At a fixed minute past each hour`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Every day`})}),_jsx(_components.td,{children:`At a fixed time between 12:00 AM and 12:15 AM UTC`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Every week`})}),_jsx(_components.td,{children:`On Sunday, at a fixed time shortly after midnight UTC`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Every month`})}),_jsx(_components.td,{children:`On the 1st of the month, at a fixed time shortly after midnight UTC`})]})]})]}),_jsx(_components.p,{children:`When you create a command with a preset, Cloud picks a random offset from the top of the hour or from midnight. The command uses the same offset for every run. To see the exact time, save the command and hover over its next run time.`}),_jsxs(_components.p,{children:[`To run a command at an exact time, select `,_jsx(_components.strong,{children:`Custom`}),` and enter a cron expression or an alias such as `,_jsx(_components.code,{children:`@hourly`}),`, `,_jsx(_components.code,{children:`@daily`}),`, `,_jsx(_components.code,{children:`@weekly`}),`, `,_jsx(_components.code,{children:`@monthly`}),`, or `,_jsx(_components.code,{children:`@yearly`}),`. For example, `,_jsx(_components.code,{children:`30 2 * * 1-5`}),` runs at 2:30 AM UTC every weekday. As you type, Cloud describes the expression in plain language. Cloud rejects invalid expressions. All schedules use UTC.`]}),_jsx(Heading,{level:`2`,id:`scheduled-commands-and-multiple-replicas`,children:`Scheduled commands and multiple replicas`}),_jsx(_components.p,{children:`Each scheduled command runs on one instance of its cluster, no matter how many replicas the cluster has.`}),_jsx(Heading,{level:`2`,id:`timeouts-and-interruptions`,children:`Timeouts and interruptions`}),_jsx(_components.p,{children:`Each run of a scheduled command may take up to 30 minutes. Cloud stops any run that is still going after 30 minutes.`}),_jsxs(_components.p,{children:[`Cloud cannot guarantee that every run will finish, even within the 30-minute limit. Deployments, scaling, and platform maintenance replace the instances that run your commands. When an instance stops, Cloud sends a `,_jsx(_components.code,{children:`SIGTERM`}),` signal to its processes and waits for your environment’s graceful shutdown timeout (30 seconds by default). Then Cloud stops any process that is still running.`]}),_jsxs(_components.p,{children:[`For this reason, write scheduled commands so they can safely run again after an interruption. If a task takes longer than a few minutes, consider breaking it into smaller pieces of work and processing them in a `,_jsx(_components.a,{href:`/workers`,children:`background worker`}),`.`]}),_jsx(Heading,{level:`2`,id:`scheduled-commands-and-scale-to-zero`,children:`Scheduled commands and scale to zero`}),_jsxs(_components.p,{children:[`Laravel Cloud wakes a sleeping App cluster to run its scheduled commands, so you can keep `,_jsx(_components.a,{href:`/compute#scale-to-zero`,children:`scale to zero`}),` enabled. You don’t need to run a separate cron process in your application or configure a manual wake interval for these commands.`]}),_jsxs(_components.p,{children:[`If your command enqueues work instead of completing it directly, configure a worker to process that queue. A `,_jsx(_components.a,{href:`/workers#workers-and-scale-to-zero`,children:`worker cluster that stays awake`}),` can process queued work independently of the App cluster.`]}),_jsx(Heading,{level:`2`,id:`view-command-output`,children:`View command output`}),_jsxs(_components.p,{children:[`Cloud sends the output of each run to your environment’s `,_jsx(_components.a,{href:`/logs`,children:`Logs`}),` dashboard. To view a command’s runs, open its `,_jsx(_components.strong,{children:`…`}),` menu and select `,_jsx(_components.strong,{children:`View logs`}),`. On the Logs page, you may filter to a single scheduled command or to every scheduled command on an instance.`]}),_jsx(_components.p,{children:`Each log entry includes the command’s output, its exit code, and when it started and finished. Cloud highlights runs that exit with a non-zero code.`}),_jsx(Heading,{level:`2`,id:`failed-command-alerts`,children:`Failed command alerts`}),_jsxs(_components.p,{children:[`When a scheduled command exits with a non-zero code, Cloud notifies you by email or Slack, based on your `,_jsx(_components.a,{href:`/notifications`,children:`notification settings`}),`. Each alert links directly to that command’s logs.`]}),_jsx(_components.p,{children:`Cloud sends at most one failure alert per scheduled command every 24 hours. For example, a command that runs every minute and fails every time produces one alert in 24 hours, not one per run. A successful run resets the limit, so Cloud alerts you right away the next time the command fails.`})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":{"light":"min-light","dark":"material-theme-palenight"}},"config":{},"pageMetadata":{"title":"Scheduled tasks","sidebarTitle":"Scheduled tasks","description":"Run recurring commands on a schedule, or run your framework's task scheduler, on Laravel Cloud.","href":"/scheduled-tasks"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Introduction","slug":"introduction","depth":2,"children":[]},{"title":"Scheduled tasks and scale to zero","slug":"scheduled-tasks-and-scale-to-zero","depth":2,"children":[],"tabId":"laravel-rust"},{"title":"Enabling the task scheduler","slug":"enabling-the-task-scheduler","depth":2,"children":[],"tabId":"laravel-php"},{"title":"Scheduled tasks and multiple replicas","slug":"scheduled-tasks-and-multiple-replicas","depth":2,"children":[],"tabId":"laravel-php"},{"title":"Scheduled tasks and scale to zero","slug":"scheduled-tasks-and-scale-to-zero-2","depth":2,"children":[],"tabId":"laravel-php"},{"title":"Enabling the task scheduler","slug":"enabling-the-task-scheduler-2","depth":2,"children":[],"tabId":"symfony"},{"title":"Cron expressions","slug":"cron-expressions","depth":2,"children":[],"tabId":"symfony"},{"title":"Scheduled tasks and scale to zero","slug":"scheduled-tasks-and-scale-to-zero-3","depth":2,"children":[],"tabId":"symfony"},{"title":"Configure scheduled commands","slug":"configure-scheduled-commands","depth":2,"children":[],"tabId":"other-stacks"},{"title":"Schedules","slug":"schedules","depth":2,"children":[],"tabId":"other-stacks"},{"title":"Scheduled commands and multiple replicas","slug":"scheduled-commands-and-multiple-replicas","depth":2,"children":[],"tabId":"other-stacks"},{"title":"Timeouts and interruptions","slug":"timeouts-and-interruptions","depth":2,"children":[],"tabId":"other-stacks"},{"title":"Scheduled commands and scale to zero","slug":"scheduled-commands-and-scale-to-zero","depth":2,"children":[],"tabId":"other-stacks"},{"title":"View command output","slug":"view-command-output","depth":2,"children":[],"tabId":"other-stacks"},{"title":"Failed command alerts","slug":"failed-command-alerts","depth":2,"children":[],"tabId":"other-stacks"}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/cloud/412bdbfbeb58e5da/gtag.js","/docs/_mintlify/custom/cloud/1a6e9e638535d772/plain.js","/docs/_mintlify/custom/cloud/f2ef70ddf7841ac3/rudderstack.js","/docs/_mintlify/custom/cloud/d55d837bfb92372f/scripts/fetch-ips.js","/docs/_mintlify/custom/cloud/715aa494111d58db/scripts/sync-prices.js"],"subdomain":"cloud","siteName":"Laravel Cloud","title":"Scheduled tasks - Laravel Cloud","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-12-01T17:38:36.033Z","originalFileLocation":"scheduled-tasks.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Run recurring commands on a schedule, or run your framework\u0026#x27;s task scheduler, on Laravel Cloud.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Laravel Cloud\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003cmeta data-mint-head name=\"robots\" content=\"noindex\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Scheduled tasks - Laravel Cloud\">\u003cmeta data-mint-head property=\"og:description\" content=\"Run recurring commands on a schedule, or run your framework\u0026#x27;s task scheduler, on Laravel Cloud.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Laravel Cloud\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://cloud.laravel.com/docs/scheduled-tasks\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://cloud.mintlify.site/docs/_mintlify/api/og/v2?division=Basics\u0026amp;title=Scheduled+tasks\u0026amp;description=Run+recurring+commands+on+a+schedule%2C+or+run+your+framework%27s+task+scheduler%2C+on+Laravel+Cloud.\u0026amp;theme=ca42ab5676c99047f1e15c7c\u0026amp;signature=cae5ba073af11d9a46465f469c99f4333784ea96baa4bd7cbb452f63bd099e56\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Scheduled tasks - Laravel Cloud\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Run recurring commands on a schedule, or run your framework\u0026#x27;s task scheduler, on Laravel Cloud.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://cloud.mintlify.site/docs/_mintlify/api/og/v2?division=Basics\u0026amp;title=Scheduled+tasks\u0026amp;description=Run+recurring+commands+on+a+schedule%2C+or+run+your+framework%27s+task+scheduler%2C+on+Laravel+Cloud.\u0026amp;theme=ca42ab5676c99047f1e15c7c\u0026amp;signature=cae5ba073af11d9a46465f469c99f4333784ea96baa4bd7cbb452f63bd099e56\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/cloud/xINqL6JT-DYt3-Cw/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Laravel Cloud\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0057FF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://cloud.laravel.com/docs/scheduled-tasks\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/scheduled-tasks.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://cloud.laravel.com/#organization\",\"name\":\"Laravel Cloud\",\"url\":\"https://cloud.laravel.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/cloud/MkfTsQSKGENWqY-2/logo/laravel-logo-light.png?fit=max\u0026auto=format\u0026n=MkfTsQSKGENWqY-2\u0026q=85\u0026s=f508d8e9c4e3c842e83d055cc376daa1\"}},{\"@type\":\"WebSite\",\"@id\":\"https://cloud.laravel.com/docs#website\",\"name\":\"Laravel Cloud\",\"url\":\"https://cloud.laravel.com/docs\",\"publisher\":{\"@id\":\"https://cloud.laravel.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://cloud.laravel.com/docs/scheduled-tasks#webpage\",\"url\":\"https://cloud.laravel.com/docs/scheduled-tasks\",\"name\":\"Scheduled tasks\",\"description\":\"Run recurring commands on a schedule, or run your framework's task scheduler, on Laravel Cloud.\",\"dateModified\":\"2026-12-01T17:38:36.033Z\",\"isPartOf\":{\"@id\":\"https://cloud.laravel.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://cloud.laravel.com/docs/scheduled-tasks#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://cloud.laravel.com/docs/scheduled-tasks#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Basics\",\"item\":\"https://cloud.laravel.com/docs/applications\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Scheduled tasks\",\"item\":\"https://cloud.laravel.com/docs/scheduled-tasks\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://cloud.laravel.com/docs/scheduled-tasks#article\",\"headline\":\"Scheduled tasks\",\"name\":\"Scheduled tasks\",\"description\":\"Run recurring commands on a schedule, or run your framework's task scheduler, on Laravel Cloud.\",\"url\":\"https://cloud.laravel.com/docs/scheduled-tasks\",\"mainEntityOfPage\":{\"@id\":\"https://cloud.laravel.com/docs/scheduled-tasks#webpage\"},\"dateModified\":\"2026-12-01T17:38:36.033Z\",\"publisher\":{\"@id\":\"https://cloud.laravel.com/#organization\"},\"isPartOf\":{\"@id\":\"https://cloud.laravel.com/docs#website\"}}]}\u003c/script>","agentPointerHref":"/docs/scheduled-tasks.md","siteName":"Laravel Cloud","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Get started","pages":[{"title":"Welcome to Laravel Cloud","sidebarTitle":"Introduction","href":"/intro"},{"title":"Quickstart","sidebarTitle":"Quickstart","mode":"wide","href":"/quickstart"},{"title":"Runtimes","sidebarTitle":"Runtimes","href":"/runtimes"},{"title":"Base images","href":"/base-images"},{"title":"Build add-ons","sidebarTitle":"Build add-ons","href":"/build-add-ons"}]},{"group":"Deploy guides","pages":[{"title":"Laravel Rust deploy guide","sidebarTitle":"Laravel Rust","href":"/deploy-guides/laravel-rust"},{"title":"Laravel PHP deploy guide","sidebarTitle":"Laravel PHP","href":"/deploy-guides/laravel"},{"title":"Laravel Go deploy guide","sidebarTitle":"Laravel Go","hidden":true,"href":"/deploy-guides/laravel-go"},{"title":"Next.js deploy guide","sidebarTitle":"Next.js","href":"/deploy-guides/nextjs"},{"title":"Nuxt deploy guide","sidebarTitle":"Nuxt","href":"/deploy-guides/nuxt"},{"title":"Node.js deploy guide","sidebarTitle":"Node.js","href":"/deploy-guides/nodejs"},{"title":"Go deploy guide","sidebarTitle":"Go","href":"/deploy-guides/go"},{"title":"Python deploy guide","sidebarTitle":"Python","href":"/deploy-guides/python"},{"title":"Ruby and Rails deploy guide","sidebarTitle":"Ruby and Rails","href":"/deploy-guides/ruby"},{"title":"Rust deploy guide","sidebarTitle":"Rust","href":"/deploy-guides/rust"}]},{"group":"Basics","pages":[{"title":"Applications","sidebarTitle":"Applications","href":"/applications"},{"title":"Environments","sidebarTitle":"Environments","href":"/environments"},{"title":"Preview Environments","sidebarTitle":"Preview Environments","href":"/preview-environments"},{"title":"Secrets","sidebarTitle":"Secrets","href":"/secrets"},{"title":"Domains","sidebarTitle":"Domains","href":"/domains"},{"title":"Domain Registration","sidebarTitle":"Domain Registration","href":"/domain-registration"},{"title":"DNS Management","sidebarTitle":"DNS Management","href":"/dns-management"},{"title":"Compute","sidebarTitle":"Compute","href":"/compute"},{"title":"Managed Queues","sidebarTitle":"Managed Queues","href":"/queues"},{"title":"Workers","sidebarTitle":"Workers","description":"Run queue workers and custom background processes on Laravel Cloud.","href":"/workers"},{"title":"Scheduled tasks","sidebarTitle":"Scheduled tasks","href":"/scheduled-tasks"},{"title":"Deployments","sidebarTitle":"Deployments","description":"Learn how deployments work in Laravel Cloud, including builds, push to deploy, deploy hooks, deployment webhooks, and zero-downtime releases.","href":"/deployments"},{"title":"Health checks","sidebarTitle":"Health checks","href":"/health-checks"},{"title":"Source control","sidebarTitle":"Source control","href":"/source-control"},{"title":"Monorepos","sidebarTitle":"Monorepos","href":"/monorepos"},{"title":"Laravel Cloud Network","sidebarTitle":"Network","href":"/network"},{"title":"Organizations","sidebarTitle":"Organizations","href":"/organizations"},{"title":"Roles and permissions","sidebarTitle":"Roles and permissions","href":"/rbac"},{"title":"Single sign-on","sidebarTitle":"Single sign-on","href":"/sso"}]},{"group":"Resources","pages":[{"group":"Databases","pages":[{"title":"Laravel MySQL","sidebarTitle":"MySQL","href":"/resources/databases/laravel-mysql"},{"title":"Serverless Postgres","sidebarTitle":"Postgres","href":"/resources/databases/postgres"}]},{"group":"Caches","pages":[{"title":"Laravel Valkey","sidebarTitle":"Valkey","href":"/resources/caches/valkey"},{"title":"Redis by Upstash (deprecated)","sidebarTitle":"Redis","href":"/resources/caches/redis"}]},{"title":"Laravel Object Storage","sidebarTitle":"Object Storage","href":"/resources/object-storage"},{"group":"WebSockets","pages":[{"title":"Laravel Cloud WebSockets","sidebarTitle":"WebSockets","href":"/resources/websockets"},{"title":"Connecting with Pusher SDKs","sidebarTitle":"Pusher SDKs","href":"/resources/websockets/pusher"}]},{"title":"Email","sidebarTitle":"Email","href":"/resources/email"},{"title":"Model gateway","sidebarTitle":"Model gateway","tag":"Early access","href":"/model-gateway"}]},{"group":"Private Cloud","pages":[{"title":"Private Cloud","sidebarTitle":"Overview","href":"/private-cloud"},{"title":"Dedicated edge network","sidebarTitle":"Edge network","href":"/private-cloud/edge-network"},{"title":"Private networking","href":"/private-cloud/private-networking"},{"title":"Internal networking","href":"/private-cloud/internal-networking"},{"title":"IAM roles","sidebarTitle":"IAM roles","href":"/private-cloud/iam-roles"},{"title":"RDS","sidebarTitle":"RDS","href":"/private-cloud/rds"},{"title":"ElastiCache","sidebarTitle":"ElastiCache","href":"/private-cloud/elasticache"},{"title":"Self-hosted GitLab","href":"/private-cloud/self-hosted-gitlab"},{"title":"Data transfer","href":"/private-cloud/data-transfer"}]},{"group":"Services","pages":[{"group":"Log Drains","pages":[{"title":"Log drains","sidebarTitle":"Overview","href":"/services/log-drains/overview"},{"title":"Log Drains Pricing","sidebarTitle":"Pricing","href":"/services/log-drains/pricing"}]}]},{"group":"Observability","pages":[{"title":"Overview","sidebarTitle":"Overview","href":"/observability"},{"group":"Metrics","pages":[{"title":"Metrics","sidebarTitle":"Overview","href":"/metrics/overview"},{"title":"Traffic metrics","sidebarTitle":"Traffic","href":"/metrics/traffic"},{"title":"Requests","sidebarTitle":"Requests","href":"/requests"},{"title":"Compute metrics","sidebarTitle":"Compute","href":"/metrics/compute"},{"title":"Queue metrics","sidebarTitle":"Queues","href":"/metrics/queues"},{"title":"Database metrics","sidebarTitle":"Databases","href":"/metrics/databases"},{"title":"Cache metrics","sidebarTitle":"Caches","href":"/metrics/caches"},{"title":"WebSocket metrics","sidebarTitle":"WebSockets","href":"/metrics/websockets"},{"title":"Object storage metrics","sidebarTitle":"Object storage","href":"/metrics/object-storage"}]},{"title":"Logs","sidebarTitle":"Logs","href":"/logs"},{"title":"Issues","sidebarTitle":"Issues","tag":"Beta","href":"/issues"},{"title":"Notifications","sidebarTitle":"Notifications","href":"/notifications"}]},{"group":"Billing","pages":[{"title":"Usage","sidebarTitle":"Usage","href":"/usage"},{"title":"Free trial","sidebarTitle":"Free trial","href":"/free-trial"},{"sidebarTitle":"Plans and pricing","title":"Plans and pricing","href":"/pricing"},{"sidebarTitle":"Taxes","title":"Taxes","href":"/taxes"},{"sidebarTitle":"Spending limits","title":"Spending limits","href":"/spending-limits"}]},{"group":"Other","pages":[{"title":"Support","mode":"wide","href":"/support"},{"title":"Changelog","sidebarTitle":"Changelog","href":"/changelog"},{"title":"Compliance \u0026 Security","mode":"wide","href":"/compliance"},{"title":"Report abuse","sidebarTitle":"Abuse","href":"/abuse"}]}]},{"tab":"Knowledge Base","pages":[{"title":"Knowledge Base","href":"/knowledge-base/intro"}]},{"tab":"API","icon":"square-terminal","pages":[{"title":"API","href":"/api/introduction"}]}]},"basePath":"","title":"Scheduled tasks - Laravel Cloud","deploymentId":"dpl_AKtEU93szkf5uRdrN9BorSfRuEzZ","buildId":"dpl_AKtEU93szkf5uRdrN9BorSfRuEzZ","dynamics":["10e4515597","07c022d89b","a74be98ba7"],"chunks":["BannerMarkdown-BJUZJRJY.js","dist-D-_STzRj.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js","Frame-B78csXn5.js","DynamicMarkdown-VDS8P-Di.js","zoom-image-lightbox-HqA14gQb.js","lightbox-handle-r17bVUz3.js"]}