---
title: Run a workflow on a schedule
project: LessCode
version: 1.0
section: recipes
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/recipes/scheduled-workflow/
updated: 2026-11-19T04:41:16.354Z
---

# Run a workflow on a schedule

> Run work every few seconds with Timer, or at set times with Crontab.

**Timer** starts a flow at a fixed interval. **Crontab** starts it at set minutes, hours or days. Both run on the server, with or without the designer open.

![A Timer flow and a Crontab flow after they ran, with Print showing their data](/files/Jap1ap31O60f.webp)

## Every few seconds: Timer

This service runs every 10 seconds, writes a log line and passes a status to Print.

1. Drag **Timer**, **Code** and **Print** onto the canvas and connect them in that order.
2. Double-click **Timer**. Set **Interval** to `10000` (milliseconds). To send fixed data, clear **Random data** and type the **Data**, for example `tick`. Select **APPLY**.
3. Double-click **Code**, paste the code below and select **APPLY**.
4. Select **APPLY** in the toolbar, then **Continue**.

![The Timer settings](/files/Jap1ar32O61f.webp)

```js
console.log('Heartbeat received:', value);
send({ status: 'ok', checked: new Date().toISOString() });
```

Every 10 seconds, Print shows the status and the time, and the log line appears in the [Console](../../guides/console/). Select **Run** on the Timer to start it at once.

## At set times: Crontab

1. Drag **Crontab** and **Print** onto the canvas and connect them.
2. Double-click **Crontab**.
3. In **Timers**, type a schedule in the empty field at the bottom and press Enter. A new Crontab has `0 9 * * *` (every day at 9:00). Remove a schedule with the bin icon next to it.
4. Choose what it sends in **Type**, for example **Current date and time**.
5. Select **APPLY**, then **APPLY** in the toolbar and **Continue**.

![The Crontab settings with the schedule * * * * *](/files/Jap1at33O60f.webp)

A schedule has five fields: minute, hour, day of month, month and day of week (0 is Sunday). `*` means every value.

| Schedule | Runs |
|---|---|
| `* * * * *` | Every minute |
| `0 9 * * *` | Every day at 9:00 |
| `0 20 * * 1` | Every Monday at 20:00 |

**Time zone offset** is in minutes. As the window says, the server time is in UTC, and the window shows the offset of your browser.

Select **Run** on the Crontab to start it at once.
