Setting a schedule
A scheduled task starts on its own only when it has a Scheduled or Webhook trigger and its status is Active. A scheduled task with a Manual Trigger runs only when someone starts it.
Add a schedule
- Open the scheduled task from the Scheduled Tasks list.
- Delete the Start step, drag Scheduled from Triggers onto the canvas, and connect it to the first step.
- Click the pencil on the trigger to open its settings.
- Under Schedule, choose a Preset. To write your own schedule, choose Custom and type a Cron Expression.
- Choose the Timezone the schedule runs in. The default is UTC.
- Click Save at the top of the builder.
The presets run at these times in the trigger's Timezone:
| Preset | Cron expression | Runs |
|---|---|---|
| Every hour | 0 * * * * | At the start of every hour |
| Every 6 hours | 0 */6 * * * | At 00:00, 06:00, 12:00, and 18:00 |
| Daily at 9:00 AM | 0 9 * * * | Every day at 09:00 |
| Daily at 6:00 PM | 0 18 * * * | Every day at 18:00 |
| Weekdays at 9:00 AM | 0 9 * * 1-5 | Monday to Friday at 09:00 |
| Weekly on Monday | 0 9 * * 1 | Mondays at 09:00 |
| Monthly on the 1st | 0 9 1 * * | The 1st of each month at 09:00 |
Choosing a timezone
Qubit reads the cron expression in the trigger's Timezone. With Riyadh (KSA) selected, Daily at 9:00 AM runs at 9:00 AM Riyadh time. In a timezone that changes its clocks for daylight saving, the schedule keeps to local time, so a 9:00 AM run stays at 9:00 AM after the clocks change.
The Weekdays at 9:00 AM preset runs Monday to Friday. For a Sunday to Thursday week, choose Custom and enter 0 9 * * 0-4.
Writing a cron expression
A cron expression has five fields separated by spaces: minute, hour, day of month, month, and day of week. In the day of week field, 0 is Sunday and 6 is Saturday. A * matches every value.
30 5 * * *: every day at 05:30.*/15 * * * *: every 15 minutes.0 6 1 1,4,7,10 *: at 06:00 on the first day of each quarter.
Qubit checks for due scheduled tasks once a minute, so the shortest interval is one minute. When you click Save or Run, Qubit checks the expression and the timezone, and shows an error instead of saving if the expression does not have five valid fields or names a date that never comes, such as 0 9 30 2 *. To see when an expression will run, try it in a tool such as crontab.guru.
Activate the schedule
Saving a schedule does not start it. Activate the scheduled task in one of these ways:
- In the Scheduled Tasks list, open the row menu and choose Activate. Qubit checks the scheduled task first and shows an error if, for example, a step is not connected, the Scheduled trigger's cron expression is missing or not valid, its timezone is not valid, or a Web Scraper, REST API, or RSS Feed step has no URL. A scheduled task whose trigger is a Manual Trigger cannot be activated.
- In the builder, set the status button to Active and click Save.
To stop the schedule, choose Deactivate in the list, or set the status to Paused or Draft in the builder and save.
Scheduled runs appear in the execution history with the trigger scheduled.
When a schedule stops
If an active scheduled task has a cron expression or timezone that Qubit cannot read, Qubit stops that schedule and keeps running the others. The scheduled task's status changes to Error, and its execution history shows a Failed run with the trigger scheduled that names the problem. Fix the schedule in the trigger settings, then activate the scheduled task again.
Metric Trigger schedules
If a scheduled task has no Scheduled trigger, the Check interval of a Metric Trigger step sets its schedule: Hourly runs at the start of every hour, Daily at 09:00 UTC, and Weekly on Mondays at 09:00 UTC. Set the scheduled task to Active with the status button in the builder.
Webhook trigger
A Webhook trigger starts the scheduled task when another system sends it a request.
- Replace the Start step with Webhook from Triggers, connect it, and click Save.
- Open the scheduled task again from the Scheduled Tasks list and click the pencil on the trigger. The Webhook URL field shows the scheduled task's URL, a copy button, and a sample
curlcommand. - Activate the scheduled task: choose Activate from its row menu in the Scheduled Tasks list, or set the status button to Active and click Save. Calls to a scheduled task that is not active are rejected.
Send a POST request to the URL. If the body is JSON, later steps can read its fields with expressions such as {{ trigger.payload.order_id }}. The body can be up to 256 KB. The response arrives when the run ends and includes the run's status.