Skip to content

Config File Reference

cronbase supports declarative job definitions in YAML or JSON files.

Loading

bash
cronbase start --config cronbase.yaml

On startup, cronbase:

  1. Reads and parses the config file
  2. For each job entry:
    • If a job with that name already exists → updates it
    • If no job with that name exists → creates it
  3. Jobs not in the config file are left unchanged

This means you can safely re-run with the same config file without duplicating jobs.

YAML format

yaml
jobs:
  - name: backup-db
    schedule: "0 2 * * *"
    command: pg_dump mydb > /backups/db.sql
    cwd: /opt/myapp
    timeout: 300
    retries: 2
    retry_delay: 60
    description: Nightly database backup
    enabled: true
    tags: [database, backup]
    env:
      PGHOST: localhost
      PGPORT: "5432"
    on_failure: https://hooks.slack.com/services/T.../B.../xxx
    on_success: https://hooks.slack.com/services/T.../B.../yyy
    on_complete: https://hooks.slack.com/services/T.../B.../zzz
    on_failure_email: ops@example.com
    on_complete_email: ops@example.com, oncall@example.com

JSON format

json
{
  "jobs": [
    {
      "name": "backup-db",
      "schedule": "0 2 * * *",
      "command": "pg_dump mydb > /backups/db.sql",
      "timeout": 300,
      "retries": 2,
      "on_failure": "https://hooks.slack.com/services/T.../B.../xxx"
    }
  ]
}

Field reference

Required fields

FieldTypeDescription
namestringUnique job identifier
schedulestringCron expression or preset
commandstringShell command (passed to sh -c)

Optional fields

FieldTypeDefaultDescription
cwdstring.Working directory for the command
timeoutnumberKill after N seconds
retriesnumber0Max retry attempts
retry_delaynumber30Base delay for exponential backoff (seconds)
descriptionstringHuman-readable description
enabledbooleantrueWhether the job runs on schedule
tagsstring[][]Tags for organization
envobjectEnvironment variables (key-value pairs)
timezonestringIANA timezone for this job (e.g. America/New_York). Overrides the CRONBASE_TIMEZONE env var for this job only.

Webhook alert shortcuts

FieldTypeEvents
on_failurestring (URL)failed, timeout
on_successstring (URL)success
on_completestring (URL)success, failed, timeout

These shortcuts create webhook alert configurations. The URL format is auto-detected — Slack and Discord URLs receive platform-specific formatted messages; all other URLs receive the raw JSON payload.

Email alert shortcuts

FieldTypeEvents
on_failure_emailstring (email)failed, timeout
on_success_emailstring (email)success
on_complete_emailstring (email)success, failed, timeout

These shortcuts create email alert configurations. Values can be a single address or comma-separated list (e.g. ops@example.com, oncall@example.com). Requires CRONBASE_SMTP_HOST to be set — see Alerting guide.

You can combine webhook and email shortcuts on the same job.

YAML parser notes

cronbase includes a built-in YAML parser that handles common config patterns without external dependencies. It supports:

  • Key-value pairs
  • Lists (with - prefix)
  • Nested objects (env blocks)
  • Quoted and unquoted strings
  • Comments with #
  • Inline arrays [a, b, c]

For advanced YAML features, use JSON format instead.

Released under the AGPL-3.0 License.