Scheduled Jobs
A scheduled job is a backend script that runs on a schedule you set with a cron expression.
Cron
Five fields, in UTC: minute hour day-of-month month day-of-week.
| Expression | Runs |
|---|---|
*/15 * * * * |
Every 15 minutes |
0 9 * * 1-5 |
09:00 UTC on weekdays |
30 6 1 * * |
06:30 UTC on the 1st of each month |
0 0 * * 0 |
Midnight UTC every Sunday (0 and 7 both mean Sunday) |
Each field takes *, a number, a range (1-5), a list (1,15) or a step (*/10, 8-18/2). The editor checks the expression as you type and says which field is out of range.
Jobs are checked every 5 minutes. Each check runs the jobs due in the five minutes from that moment, so a job due at 9:02 may start a few minutes before or after 9:02. Schedules finer than 5 minutes run once per check.
What the script receives
input.payload.scheduledFor is the time of the check, as an ISO date.
const res = await requestJira('/rest/api/3/search/approximate-count', {
method: 'POST',
body: JSON.stringify({ jql: 'statusCategory != Done AND duedate < now()' }),
})
const { count } = await res.json()
console.log(`${count} overdue work items at ${input.payload.scheduledFor}`)
Running and stopping
- A job may run for up to 5 minutes, or less if you set a lower time limit in Settings.
- Disable the script to stop it without deleting it; it keeps its code, settings and logs.
- Every run, and anything it logs, appears under Logs.
- Test run (⌘↵) runs the unsaved code once, now.