Run a flow on a schedule
Run a flow every night, every hour or on weekdays, without remembering to start it.
You need: a project with a flow, and the daemon. Only the
daemon starts flows on a schedule; truss run ignores schedules.
1. Add the schedule to the flow
Section titled “1. Add the schedule to the flow”version: "1"flow: name: backupon: schedule: - cron: "0 2 * * *" # every day at 02:00steps: - id: copy run: rsync -a ~/photos/ /mnt/backup/photos/A cron time has five fields: minute, hour, day of month, month, day of week.
| Cron | Runs |
|---|---|
0 * * * * |
every hour |
*/15 * * * * |
every 15 minutes |
0 2 * * * |
every day at 02:00 |
0 9 * * 1-5 |
Monday to Friday at 09:00 |
0 0 1 * * |
on the 1st of every month at midnight |
@daily |
every day at midnight (@hourly, @weekly, @monthly, @yearly also work) |
truss init and truss flows new can write the schedule from plain words (“every day at 02:00”).
All cron forms are in the triggers reference.
A schedule can also say which time zone it means and what to do about missed times:
on: schedule: - cron: "0 9 * * 1-5" timezone: Europe/Berlin # default: this machine's time zone missed: run # default: skip2. Give it to the daemon
Section titled “2. Give it to the daemon”$ truss validate backup # check the file$ truss daemon start # start the background service$ truss register backup # or: truss register --allregistered backup (/home/me/project/.truss/flows/backup.yaml)schedule 0 2 * * *: next run 2026-11-02 02:00:00$ truss schedules # every schedule and when it runs nextEdit the file later and save: the daemon notices within a second. You do not register it again.
To keep schedules running after a restart, start the daemon at login, once:
$ truss daemon install3. What if the machine was off?
Section titled “3. What if the machine was off?”A laptop sleeps and is switched off. By default TRUSS does not run a late job when you open the lid
at 11:00: a missed 09:00 run is recorded as skipped.
missed |
When a planned time passed while the machine was off or the daemon stopped |
|---|---|
skip (default) |
Nothing runs. The history shows a skipped run with the planned time. |
run |
One catch-up run starts as soon as the daemon is back, however many times were missed. |
4. Make sure runs do not pile up
Section titled “4. Make sure runs do not pile up”If a run is still going when the next one is due, flow.overlap decides:
flow: name: sync overlap: skip # queue (default) | skip | parallelqueue waits for the first run to end, skip drops the new one, parallel starts both.
5. Check on it
Section titled “5. Check on it”$ truss schedules # what runs next$ truss runs backup # the latest runs of this flow$ truss runs show last # steps, exit codes, a timeline$ truss logs <run-id> # the log of one run$ truss pause backup # stop its schedules for now$ truss resume backup # and start them againGet notified when a run fails, so you do not have to look.
It does not run?
Section titled “It does not run?”truss schedulesdoes not list it: the flow is not registered (truss register backup).- It lists it as
paused:truss resume backup. - The daemon is not running:
truss daemon status. - It ran, but the command failed under the daemon only: the daemon can have a shorter
PATHthan your terminal. See Troubleshooting.