cron
Manage cron jobs.
Subcommands
| Command | Description |
|---|---|
runix cron list | List all cron jobs |
runix cron start <name> | Enable a cron job |
runix cron stop <name> | Disable a cron job |
runix cron run <name> | Manually trigger a cron job |
cron list
List all registered cron jobs.
runix cron list
Output:
NAME SCHEDULE ENABLED RUNS LAST RUN
cleanup 0 */6 * * * yes 12 2025-01-15 06:00:00
metrics */5 * * * * yes 144 2025-01-15 10:35:00
backup 0 2 * * * no 0 never
info
Cron management requires a running daemon. If the daemon is not running, cron list shows "No cron jobs configured (daemon not running)".
cron start
Enable a disabled cron job.
runix cron start cleanup
# [Runix] Cron job "cleanup" started
cron stop
Disable a cron job (keeps it registered but unscheduled).
runix cron stop cleanup
# [Runix] Cron job "cleanup" stopped
cron run
Manually trigger a cron job immediately.
runix cron run cleanup
# [Runix] Cron job "cleanup" triggered
The job runs asynchronously in a goroutine. The command returns immediately.
Cron Job Configuration
Cron jobs are defined in runix.yaml:
cron:
cleanup:
schedule: "0 */6 * * *" # Every 6 hours
command: "rm -rf /tmp/old-*"
enabled: true
cwd: /tmp
env:
CLEANUP_MODE: aggressive
timeout: 5m
backup:
schedule: "0 2 * * *" # Daily at 2 AM
command: "pg_dump mydb > /backups/mydb.sql"
enabled: true
timeout: 30m
Schedule Format
Supports both 5-field and 6-field (with seconds) cron expressions:
# 5-field (standard)
"*/5 * * * *" # Every 5 minutes
"0 */6 * * *" # Every 6 hours
"0 2 * * *" # Daily at 2 AM
"0 0 * * 0" # Every Sunday at midnight
# 6-field (with seconds)
"0 */5 * * * *" # Every 5 minutes (explicit seconds)
"30 0 * * * *" # Every day at 00:00:30
When a 5-field expression is provided, Runix auto-prepends 0 for the seconds field.
What's Next
- Cron Scheduling — How the cron scheduler works
- Configuration Reference — Cron job config fields