cortex jobs

Manage scheduled cron jobs that run on the daemon scheduler. Jobs are persisted in SQLite with retry logic and status tracking.

Usage

cortex jobs <subcommand> [options]

Subcommands

SubcommandDescription
listList all jobs with their status and next run time
add <name> <command>Create a new scheduled job
cancel <id>Cancel a pending or failed job
run-dueExecute all currently due jobs immediately

cortex jobs add Options

OptionDescription
--cron <expr>CRON expression (e.g., 0 9 * * 1 for weekly Monday 9AM)
--in <minutes>Run after N minutes from now
--max-attempts <n>Max retry attempts on failure (default: 3)

Scheduler Behavior

  • The scheduler daemon polls the database for due jobs
  • On failure, jobs are retried with configurable backoff
  • Execution history is logged for audit
  • Memory consolidation can be scheduled as a recurring job
  • CRON jobs auto-reschedule after completion

CRON Format

┌───────── minute (0-59)
│ ┌───────── hour (0-23)
│ │ ┌───────── day of month (1-31)
│ │ │ ┌───────── month (1-12)
│ │ │ │ ┌───────── day of week (0-6, 0=Sunday)
│ │ │ │ │
* * * * *

Examples

# Add a weekly report every Monday at 9 AM
cortex jobs add weekly-report "generate-weekly-report" --cron "0 9 * * 1"

# Add a one-time job to run in 30 minutes
cortex jobs add quick-backup "run-backup" --in 30

# List all jobs
cortex jobs list

# Cancel a pending job
cortex jobs cancel job_xyz789

# Run all due jobs immediately
cortex jobs run-due