Run a job every minute
The cron expression for every minute is * * * * *. A * in all five fields matches every minute of every hour and day, 1,440 runs a day. That is as often as cron goes: it has no seconds field.
crontab syntax · 5 fields
*****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
*Minute- Every minute
*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
* * * * * /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: "* * * * *"GitHub runs schedules at most every 5 minutes
It won't run this as often as written, and runs often start late when GitHub is busy. In a public repository, GitHub turns the schedule off after 60 days without activity.
cronjob.yaml (excerpt)
spec:
schedule: "* * * * *"
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-minute \
--schedule-expression "cron(* * * * ? *)"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(1 minute) 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": "* * * * *" }
]
}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 every-minute schedules
Keep the minute as * and narrow the hour or weekday fields to run every minute only part of the time.
| Expression | Runs |
|---|---|
*/1 * * * * | Same as * * * * *, written as a step of 1 |
* 9-17 * * 1-5 | Every minute from 09:00 through 17:59, Monday through Friday |
* 0 * * * | Every minute from 00:00 through 00:59, then not until tomorrow |
*/2 * * * * | Every 2 minutes, 720 runs a day |