Migrating from Cron

Step-by-step guide to replace crontab entries with CueAPI cues.

Why migrate?

FeatureCronCueAPI
API-managed schedulesNoYes
Pause/resume without editing configNoYes
Execution historyNoYes
Automatic retriesNoYes (3 attempts)
Outcome reportingNoYes
Signed webhook deliveryNoYes
Works across machinesNoYes (worker transport)
VisibilityCheck logs manuallyDashboard + API

Step 1: Identify your cron jobs

List your current crontab:

bash
crontab -l

Example output:

0 9 * * * /usr/bin/python3 /scripts/daily_report.py
*/15 * * * * /scripts/sync_inventory.sh
0 0 1 * * /scripts/monthly_cleanup.py

Step 2: Install the CueAPI CLI and worker

bash
pip install cueapi cueapi-worker
cueapi login

Step 3: Create a worker config

Create cueapi-worker.yaml mapping your scripts to handler tasks:

yaml
handlers:
  daily-report:
    cmd: "python3 /scripts/daily_report.py"
    timeout: 120
 
  sync-inventory:
    cmd: "/scripts/sync_inventory.sh"
    timeout: 60
 
  monthly-cleanup:
    cmd: "python3 /scripts/monthly_cleanup.py"
    timeout: 300

Step 4: Create cues for each job

bash
# Daily report at 9 AM
cueapi create \
  --name "daily-report" \
  --cron "0 9 * * *" \
  --transport worker \
  --payload '{"task": "daily-report"}'
 
# Inventory sync every 15 minutes
cueapi create \
  --name "sync-inventory" \
  --cron "*/15 * * * *" \
  --transport worker \
  --payload '{"task": "sync-inventory"}'
 
# Monthly cleanup
cueapi create \
  --name "monthly-cleanup" \
  --cron "0 0 1 * *" \
  --transport worker \
  --payload '{"task": "monthly-cleanup"}'

Step 5: Start the worker

bash
cueapi-worker start --config cueapi-worker.yaml

Step 6: Verify and remove old cron entries

Check that your cues are running:

bash
cueapi list
cueapi get cue_xxxxx

Once confirmed, remove the old crontab entries:

bash
crontab -e
# Remove the migrated lines

Step 7: Install as a service (optional)

To ensure the worker starts automatically:

bash
# macOS
cueapi-worker install-service --config /path/to/cueapi-worker.yaml
 
# Linux
cueapi-worker install-service --config /path/to/cueapi-worker.yaml
systemctl --user enable cueapi-worker

Cron expression mapping

Your existing cron expressions work as-is in CueAPI. The syntax is identical:

# These are the same in crontab and CueAPI
0 9 * * *        → --cron "0 9 * * *"
*/15 * * * *     → --cron "*/15 * * * *"
0 0 1 * *        → --cron "0 0 1 * *"

Note

CueAPI cron expressions support timezone specification. If your crontab runs in a specific timezone, add --timezone when creating the cue.

What you gain

After migration, each former cron job now has:

  • Pause/resume without editing configs
  • Execution history visible in the dashboard
  • Automatic retries if a script fails
  • Outcome reporting so you know what happened
  • Usage tracking per plan