Docs/Candor Deploy

Scheduled jobs

Run a command on your servers on a schedule, once, by hand or after an event, with retries, environment variables, secrets, live logs and notifications. Or schedule an Actions workflow.

A job runs a command on one or more of your servers: every night, once at a set time, only when you press a button, or after something happens, such as a failed deploy. Every run is kept with its result, how long it took and its output.

Use jobs for things like a nightly database dump, warming a cache, or a cleanup script. Find them under Jobs in the sidebar.

Create a job

  1. Open Jobs and press New job.
  2. Under Basics, give it a Name and enter the Command.
  3. Under Target servers, pick one or more of your servers. The command runs on each one.
  4. Under Schedule, choose When to run:
    • On a schedule: enter a cron expression (see below).
    • Once: pick the date and time in Run at.
    • Manual: it runs only when you press Run now, or when another job or an event starts it.
  5. Fill in the optional sections you need, then press Create job.

The summary on the right shows what you are about to save.

Where the command runs

The command runs on the server itself, over the same SSH connection Candor Deploy uses to manage it, as the user you connected with. It is not run inside one of your app containers. To run something in a container, use docker run --rm <image> <command> as the command.

Because a job can run anything on the server, creating, editing or reading a job needs admin access to all of its target servers. Workspace owners and admins have it. See Team members and roles.

Schedules (cron)

A schedule is a standard five-field cron expression. Times are in UTC.

┌───────── minute (0–59)
│ ┌─────── hour (0–23)
│ │ ┌───── day of month (1–31)
│ │ │ ┌─── month (1–12)
│ │ │ │ ┌─ day of week (0–6, Sunday is 0)
* * * * *
CronRuns
0 3 * * *every day at 03:00 UTC
*/15 * * * *every 15 minutes
0 * * * *every hour, on the hour
0 2 * * 0every Sunday at 02:00 UTC
30 4 1 * *at 04:30 UTC on the 1st of each month

The expression is checked when you save.

Optional settings

Reliability.

  • Timeout (s): stop the run if it takes longer than this.
  • Max attempts and Backoff (s): retry a failed run, waiting this many seconds between attempts. One attempt means no retry.

Environment. Add Environment variables the command can read, one by one, or with Paste .env or Upload .env. Put passwords and tokens under Secrets instead: they are encrypted, and once saved they are not shown again. To change them, use Replace secrets.

Dependencies & triggers.

  • Run after: run this job when the selected jobs succeed.
  • Event triggers: run it when something happens in your workspace: a deploy succeeded or failed, a backup succeeded or failed, a restore completed, a certificate could not be renewed, or a domain’s DNS check failed.

Notifications. Choose channels and which run results to send to them (by default, failures). This overrides your general notification settings for this job. Channels are set up under Monitoring, then Notifications.

Run, watch and change a job

  • Run now starts a run straight away. Manual runs are kept in the history like scheduled ones.
  • Open a job to see its settings and its Runs. Open a run to see its output. A run in progress streams its output live.
  • Edit changes any setting. Disable stops the schedule without deleting the job; Enable turns it back on. Delete removes it.

Run an Actions workflow on a schedule

A job can start a saved Actions workflow instead of a command.

  1. In New job, switch to the workflow tab, or choose Schedule with Jobs from a workflow.
  2. Choose the workflow. Only enabled workflows with a manual trigger (workflow_dispatch) can be chosen.
  3. Fill in the workflow’s inputs, and choose a schedule or event as above.

The workflow keeps its own runners, secrets and storage. The job only decides when it starts. The run history links to the Actions run, where you see each job, its logs and the option to cancel.

Things to know

  • A job uses the target server’s memory, CPU and disk, alongside your apps. Schedule heavy work for quiet hours.
  • A job does not copy anything off the server unless your command does. If your command writes a dump to the server’s disk, that file is still on the same server.
  • If a server cannot be reached when a job is due, that run fails and the failure is recorded in the history.
  • Actions: CI workflows on your own servers.
  • Add a server: connect a server for jobs to run on.

Something here wrong, unclear or missing? Tell us. Docs get fixed like bugs.

Not a customer yet? Start a free trial, or see plans and limits.