Skip to content

Docs Guides

Cron jobs

Schedule commands across your servers with retries, timeouts, overlap control, history and alerts.

A job runs a command on a schedule, on the servers you target. Every run is recorded with its output, exit code and duration.

Define a job

jobs:
  nightly-report:
    schedule: "0 3 * * *"
    timezone: Europe/Berlin
    target: role=worker
    run_on: one            # one healthy server, or "each"
    service: worker        # optional: run inside this service's image
    command: node scripts/report.js
    timeout: 15m
    retries: 3
    overlap: skip
    notify: [slack:#ops]
FieldDescriptionDefault
scheduleFive-field cron expression, or @hourly, @daily, @weekly, @monthlyrequired
timezoneIANA timezone, DST-awareworkspace timezone
targetWhere it can run, see targetsrequired
run_onone healthy server or each matching serverone
serviceRun inside the image of this service, with its environmentrun on the host
commandThe command to runrequired
timeoutKill the run after this long1h
retriesExtra attempts after a failure, with growing backoff0
overlapskip, queue or allow when the previous run is still goingskip
notifyWhere failures, missed runs and slow runs gothe job owner by email

Host commands run as the fwoop user. To run as another user, set user:; the agent needs a sudoers rule for it.

Import existing crontabs

The agent can read the crontabs on a server and suggest a job for each entry:

$ fwoop jobs import --server web-01
Found 4 entries in /etc/crontab and 1 in crontab -u deploy
? Adopt "0 3 * * * /opt/app/report.sh" as nightly-report? Yes
✓ Adopted 3 jobs; the original lines are commented out

Runs and history

$ fwoop jobs history nightly-report
#412  succeeded  2m 44s  retried once  today 03:00
#411  succeeded  2m 31s                yesterday 03:00
$ fwoop jobs run nightly-report        # run now, outside the schedule

When things go wrong

  • Failed: the command exited non-zero after all retries.
  • Missed: no matching server was online at the scheduled time. Set catch_up: true to run once it’s back.
  • Slow: a run took more than twice its usual duration.

Each sends a notification to notify. Agents keep their schedules locally, so jobs still run if the control plane is unreachable; results sync when it’s back.