Skip to content

Creating a job

The form field by field — the command, the schedule, agents, tags, secrets and four switches, including what holds if you leave them alone.

A job is a shell command that runs on a schedule, on the agents you give it. On the Jobs screen, Create job makes one; creating and editing jobs is for the operator role and above (roles). The same form serves for editing, with a Save changes button.

Name

The name you will see the job under everywhere — in the list, on the dashboard, in emails and in the audit log. Required.

Command

The command as you would type it into a terminal on the host. The agent runs it through sh -c, so pipes, redirections and variables work as they do in a shell. Two things differ from your own terminal:

  • it runs as runjet-job, in that account's home, not as you (job isolation),
  • it is given a built environment rather than the agent's: PATH from the systemd unit, HOME and USER of the job account, TZ, LANG, LC_*, and beyond that only what the host has named in AGENT_PASS_ENV (why). A script that runs at home because it leans on a JAVA_HOME from your profile will not run here without that setting.

A multi-line command is fine; the field is a textarea. A script longer than a few lines, though, belongs in a file on the host, with only its invocation here.

Tags

Tags, separated by commas. A name that does not exist yet is created by saving. What can be done with them is on the tags and filtering page.

Schedule

A builder with five modes and one for raw cron; described on the scheduling page. Times are in the workspace's timezone.

Agents

A tick box for every agent in the workspace. Every ticked agent runs the job at every scheduled time — a job on three agents is three runs to a tick, which is how one job keeps a whole fleet in order (assigning agents).

An agent may be marked (not enrolled yet) — it is registered, but enrolment has not happened on the host yet — or (disabled). Both can be ticked and both are skipped on a tick; the job then appears in the list with a warning. With no agent at all in the workspace the form says No agents registered yet. A job cannot run until one exists.

An enabled job must have at least one agent, or the form will not save it (An enabled job needs at least one agent to run it.). A disabled job may have none.

Secrets

The names of the variables, separated by commas, that the command needs and whose values the agent holds on the host. Names only; there is nowhere here to type a value. The whole of it is on the secrets page.

Catch up missed runs

Off unless you switch it on. On means: if Runjet was not running at a scheduled time, the job runs once at startup — once, however many occurrences were missed. When that helps and when it does not is on the missed runs page.

Email me when this job fails

On unless you switch it off. A job created without an opinion is a job somebody hears about; the other default leads to a silence nobody chose. One message arrives when the job starts failing on an agent, and one when it works there again — not one per failed run. It goes to everyone who administers or operates the workspace. This switch is the master one: off, it silences every message about this job, the recovery included.

Email me if a run takes too long

On with a default threshold unless you intervene. Past the threshold one message arrives about that run and no more; Runjet does not stop the run. The hours field changes the threshold for this job (1 to 8,760 hours); switching the toggle off means this job is not worth a message however long it takes. Leave the default number and the job follows Runjet's own default threshold even after it changes — that is the difference between "I have no opinion" and "exactly eight". Why a run has no limit, and what the threshold does instead, is on the long-running jobs page.

Enabled

An enabled job is in the scheduler and runs; a disabled one is not in it at all, does not appear in what is next up, and cannot even be run by hand (Enable the job to run it). The run history stays. The switch is on the job list as well, so silencing a job for maintenance does not mean opening the form.

What happens after saving

The job is written and the running scheduler takes it up immediately; the first run arrives with the schedule's first tick, or sooner through running by hand. Creating, every edit and deleting are all rows in the audit log. Only an admin may delete a job, because its whole run history goes with it.