Scheduled tasks
Run a command at a set time (an export, a clean-up, sending emails): the frequency and the cron expression.
Add a task
Section titled “Add a task”In an application’s panel, Scheduled tasks tab, click Add a scheduled task:
- Command: what will run, inside the service’s container (for example
php artisan reports:sendornode scripts/cleanup.js); - Schedule: when;
- Enabled: untick it to pause the task without deleting it.
The task applies at the project’s next deployment.
Choose the frequency
Section titled “Choose the frequency”- Every day, with the Execution time;
- Every week, with the Day of the week and the time;
- Every month, with the Day of the month and the time;
- Custom: a cron expression.
The console always turns the schedule into a sentence, for example “This task will run every Monday at 03:00.” Read it before saving.
The cron expression
Section titled “The cron expression”Five fields separated by spaces, in this order: Minute, Hour, Day of month, Month, Day of week (0 or 7 = Sunday).
| Expression | What the console says |
|---|---|
0 3 * * * | every day at 03:00 |
*/15 * * * * | every 15 minutes |
30 8 * * 1-5 | at 08:30, Monday through Friday |
0 0 1 * * | on the 1st of every month at 00:00 |
A day of the month after the 28th skips the months that are too short: the console points it out.
With your agent
Section titled “With your agent”Your agent can add a scheduled task in a plan. For example, ask it: “Add a task that runs php artisan backup:clean every night at 2 a.m. and prepare the plan.”