User-friendly cron scheduler with aux4/jobs integration.
aux4 aux4 pkger install aux4/cron
# Start the scheduler
aux4 cron start
# Add a task that runs every 5 minutes
aux4 cron add --name cleanup --every "5 min" --run "aux4 cleanup run"
# Add a daily task at 2am
aux4 cron add --name backup --every "1 day" --at "02:00" --run "aux4 backup run"
# List all tasks
aux4 cron list
# View execution history
aux4 cron history --name backup
# Stop the scheduler
aux4 cron stop
aux4 cron start
aux4 cron start --port 9000
aux4 cron start --dir /var/data
aux4 cron stop
aux4 cron stop --port 9000
aux4 cron add --name cleanup --every "5 min" --run "rm -rf /tmp/cache/*"
aux4 cron add --name backup --every "1 day" --at "02:00" --run "aux4 backup run"
aux4 cron add --name report --every monday --at "09:00" --run "aux4 report generate"
aux4 cron add --name heartbeat --every 30s --run "curl -s http://localhost/health"
# One-time delayed task (runs once then auto-removes)
aux4 cron add --name reminder --in "5 min" --run "echo time is up"
# Limited executions (auto-removes after 3 runs)
aux4 cron add --name retry --every 10s --max 3 --run "curl -s http://localhost/health"
# Run once at a specific time (AM/PM supported)
aux4 cron add --name alert --at "2pm" --run "echo lunch time"
aux4 cron remove --name cleanup
aux4 cron pause --name backup
aux4 cron resume --name backup
aux4 cron list
aux4 cron history --name backup
aux4 cron history --name backup --limit 20
| Expression | Type | Meaning | |---|---|---| | 10s | interval | Every 10 seconds | | 30s | interval | Every 30 seconds | | 5 min or 5min | interval | Every 5 minutes | | 15 min | interval | Every 15 minutes | | 2 hours or 2h | interval | Every 2 hours | | 1 day | daily | Every day (use --at for specific time, default midnight) | | monday | weekly | Every Monday (use --at for time) | | tuesday...sunday | weekly | Every specific weekday | | weekday | weekly | Monday through Friday | | weekend | weekly | Saturday and Sunday | | 1 month | monthly | Every month on the 1st |
Short forms: 10s, 5min, 2h, 1d Long forms: 10 seconds, 5 minutes, 2 hours, 1 day Singular/plural: 1 minute = 1 min Day names are case-insensitive.
| Flag | Description | |------|-------------| | --in "5 min" | Run once after a delay, then auto-remove | | --at "2pm" (without --every) | Run once at the specified time, then auto-remove | | --max 3 | Stop and auto-remove after N executions |
Time formats for --at: HH:MM (24h), 2pm, 2:30pm, 12:00am.
When a cron entry triggers, it executes the command via aux4 jobs run "<command>". This provides:
View job details with:
aux4 jobs status <jobId>
aux4 jobs output <jobId>
.cron.json stores all cron entries (created in the working directory).cron-history.json stores execution history (last 1000 entries)