Migrating from Cron
Step-by-step guide to replace crontab entries with CueAPI cues.
Why migrate?
| Feature | Cron | CueAPI |
|---|---|---|
| API-managed schedules | No | Yes |
| Pause/resume without editing config | No | Yes |
| Execution history | No | Yes |
| Automatic retries | No | Yes (3 attempts) |
| Outcome reporting | No | Yes |
| Signed webhook delivery | No | Yes |
| Works across machines | No | Yes (worker transport) |
| Visibility | Check logs manually | Dashboard + API |
Step 1: Identify your cron jobs
List your current crontab:
bash
crontab -lExample 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 loginStep 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: 300Step 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.yamlStep 6: Verify and remove old cron entries
Check that your cues are running:
bash
cueapi list
cueapi get cue_xxxxxOnce confirmed, remove the old crontab entries:
bash
crontab -e
# Remove the migrated linesStep 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-workerCron 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