Explita InfraExplita Infra
DeployCLI Reference

eda cron

Manage and monitor scheduled background cron jobs executing inside application containers

The eda cron command group manages scheduled background jobs. Cron tasks execute directly inside your running application container without requiring external webhooks or third-party scheduling SaaS.

eda cron <command> [options]
explita deploy cron <command> [options]

1. Subcommands Overview

CommandDescription
eda cron ls [-a <appId>]List all scheduled background jobs configured for the application.
eda cron run <job> [-a <appId>]Manually trigger immediate execution of a cron job for testing.
eda cron pause <job> [-a <appId>]Pause automated execution of a scheduled cron job.
eda cron resume <job> [-a <appId>]Resume automated execution of a paused cron job.
eda cron history [-a <appId>]View recent job execution history, exit codes, and output logs.

2. Defining Cron Jobs in explita.json

Cron jobs are declared declaratively in your project's explita.json:

{
  "$schema": "https://infra.explita.ng/config/schema.json",
  "deploy": {
    "name": "payment-api",
    "crons": [
      {
        "name": "sync-data",
        "schedule": "*/10 * * * *",
        "command": "node dist/jobs/sync-fx.js"
      },
      {
        "name": "daily-digest",
        "schedule": "0 8 * * *",
        "command": "python manage.py send_digest"
      }
    ]
  }
}

3. Usage Examples

List Configured Cron Jobs

eda cron ls

Sample Output:

Scheduled Background Jobs for payment-api:

┌─────────┬───────────────┬────────────────┬────────────────┬────────────────────┬──────────────────┬──────────┬───────────┬─────────────────────┐
│ (index) │ ID            │ Job            │ Schedule       │ Description        │ Command          │ Next Run │ Last Run  │ Status              │
├─────────┼───────────────┼────────────────┼────────────────┼────────────────────┼──────────────────┼──────────┼───────────┼─────────────────────┤
│ 0       │ 'c_9f3a12001' │ 'sync-data'    │ '*/10 * * * *' │ 'Every 10 minutes' │ 'node sync.js'   │ 'in 6m'  │ '4m ago'  │ '✔ success (120ms)' │
│ 1       │ 'c_9f3a12002' │ 'daily-digest' │ '0 8 * * *'    │ 'Daily at 08:00'   │ 'npm run digest' │ 'in 14h' │ '10h ago' │ '✔ success (340ms)' │
└─────────┴───────────────┴────────────────┴────────────────┴────────────────────┴──────────────────┴──────────┴───────────┴─────────────────────┘

Manually Trigger a Job Immediately

You can trigger a job manually by passing its name, ID, or 1-based index:

# By name
eda cron run sync-data

# By database record ID (from eda cron ls)
eda cron run c_9f3a12001

# By 1-based index (e.g. 1 for the first job in the table)
eda cron run 1

Executes the command inside the running container and streams real-time stdout/stderr output.

Pause & Resume Automated Runs

# Temporarily pause a scheduled job during maintenance
eda cron pause sync-data

# Resume regular automated scheduling
eda cron resume sync-data

Inspect Execution History

eda cron history

Displays recent job execution logs, timestamps, duration, and exit codes.

On this page