Schedules
How often a task runs, and how to keep it inside certain hours.
tloop add --name pull-notes --cmd "git pull --ff-only" --cwd ~/notes --interval 1h --hours 9-21That task pulls your notes once an hour, but only from 09:00 to 20:59.
Intervals
An interval is a whole number and a unit:
| Unit | Example | Runs |
|---|---|---|
s | 30s | every 30 seconds |
m | 15m | every 15 minutes |
h | 1h | every hour |
d | 1d | every day |
Anything else, like 1.5h or 1h30m, is rejected. Write 90m instead.
The interval counts from when the task is loaded, not from the top of the hour. A 1h task added at 09:20 runs at 09:20, 10:20, 11:20 and so on. A task is loaded when you add, edit or start it, and when you log in, and it runs once each time.
If your Mac is asleep when a run is due, launchd runs it when the Mac wakes up. Several missed runs turn into one.
Hours
--hours <start>-<end> keeps a task inside a window each day, on your Mac's clock:
- The start hour is in the window, and the end hour isn't.
9-21runs from 09:00 to 20:59. - Hours use the 24-hour clock, from
0to23. - The start has to be smaller than the end. An overnight range like
22-6never runs.
The interval keeps ticking outside the window. A run that falls outside doesn't start your command. It writes one line to its log, Outside working hours (9-21), skipping, and exits.
tloop run ignores --hours, so you can test a task at any time.