Scheduled jobs
A container that starts on a schedule, does its work and then exits.
On this page
What it is
A scheduled job is a container that klickops starts on a schedule. It does its work and exits. At the next scheduled time, klickops starts it again. Each start is called a run. Every run has its own exit code and its own logs. You decide how long klickops keeps them.
An app works the other way around. It should keep running, and klickops restarts it when it exits. A job should exit. If it keeps running, something went wrong.
When you'd use it
- A nightly export, an invoice run or a cleanup.
- Fetching data from someone else's API on a regular basis.
- A migration that should run on a schedule.
Some work should react to an event and has nothing to do with the time of day. A scheduled job is the wrong place for that. A queue consumer, for example, must always be listening. It belongs in an app.
Create one
- Open the project. Go to Scheduled jobs, then New scheduled job.
- Give the job a name and the image to run. You can add a command, but you don't have to. Without one, the image's own entrypoint runs.
- Set the schedule as a cron expression. The default
0 * * * *means at the start of every hour. The form translates the expression into plain words. Later, the job's Schedule tab lists its next runs. That way you can check that the expression does what you want. - Leave resources on automatic. Only change them if you know the job needs a lot of power.
- Create the job. It shows its next run time and waits.


Watching it
Open the job. The Runs tab lists every start with its result and duration. Each run keeps its own logs, so you can see why a run failed.
With Run now you start a run by hand. This works as long as the job isn't paused. The run starts right away and the schedule stays the same. Use it to test the job before it runs on its own.
Settings reference
| Setting | Default | What it does |
|---|---|---|
| Schedule | 0 * * * * | The cron expression. By default the job runs every hour. |
| Timezone | UTC | The clock the schedule follows. Set it to Europe/Zurich, for example, if the job should run at midnight Swiss time. |
| Concurrency | Allow | Decides what happens when a run is still going and the next one is due. With Forbid, the new run is skipped. With Replace, klickops stops the old run. |
| Kept runs | 3 successful, 1 failed | Decides how many runs and logs klickops keeps. |
| Resources | automatic | CPU and memory. Raise them for a job that does heavy work. |
| Paused | no | Pause stops the schedule and keeps the job. Resume starts the schedule again. |
Limits and gotchas
- The default
Allowlets runs overlap. If a job takes longer than its interval, two runs happen at the same time. If that's risky, setForbid. - A missed run is skipped. If the cluster couldn't start a run, klickops doesn't run it later.
- Logs disappear with their run. The number of kept runs decides how far back you can look. By default only the last three successful runs stay.
- A job that never exits causes trouble. With
Forbidit blocks the next run. WithAllowthe runs pile up. So build a timeout into long jobs yourself.