Run a job every 5 minutes
The cron expression for every 5 minutes is */5 * * * *. The */5 step in the minute field fires at :00, :05, :10 and so on through :55, 12 times an hour, every hour of every day.
crontab syntax · 5 fields
*/5****Next 5 runs
Vercel always runs schedules in UTC, and GitHub Actions does unless you set a time zone. Crontab and Kubernetes use the server's time zone.
Field by field
*/5Minute- Every 5th minute: 0, 5, 10 … 55
*Hour- Every hour, 0 to 23
*Day of month- Every day of the month
*Month- Every month
*Day of week- Every day of the week
By platform
Most schedulers take the same five fields. The wrapper, time zone and limits differ.
crontab -e
# m h dom mon dow command
*/5 * * * * /usr/local/bin/sync.sh >> /var/log/sync.log 2>&1Runs in the server's local time zone
Cron starts jobs with a minimal environment: use absolute paths, and send output to a log so failures don't disappear.
.github/workflows/sync.yml
on:
schedule:
- cron: "*/5 * * * *"5 minutes is the shortest interval GitHub allows
Runs often start a few minutes late when GitHub is busy. In a public repository, GitHub turns the schedule off after 60 days without activity.
cronjob.yaml (excerpt)
spec:
schedule: "*/5 * * * *"
timeZone: "Etc/UTC"
concurrencyPolicy: ForbidWithout timeZone, the controller's zone applies
Set timeZone to pin the schedule. concurrencyPolicy: Forbid stops a slow run from overlapping the next one.
AWS CLI
aws events put-rule \
--name sync-every-5-minutes \
--schedule-expression "cron(0/5 * * * ? *)"Six fields, and one day field must be ?
EventBridge adds a year at the end and needs
? in day-of-month or day-of-week. For a plain interval, rate(5 minutes) is simpler, though its runs are timed from when you create the rule rather than by the clock.vercel.json
{
"crons": [
{ "path": "/api/sync", "schedule": "*/5 * * * *" }
]
}Needs a paid plan
On Hobby, cron jobs run at most once a day, so this schedule fails at deploy time. Vercel runs crons in UTC.
Other 5-minute schedules
Start the step at another minute to move runs off the round fives, or narrow the hour and weekday fields.
| Expression | Runs |
|---|---|
0,5,10,15,20,25,30,35,40,45,50,55 * * * * | Same as */5 * * * *, with the minutes listed |
2-59/5 * * * * | Every 5 minutes at :02, :07, :12 and so on through :57 |
*/5 9-17 * * 1-5 | Every 5 minutes from 09:00 through 17:55, Monday through Friday |
*/5 * * * 1-5 | Every 5 minutes, all day, Monday through Friday |
5 * * * * | Once an hour at :05, not every 5 minutes |